New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please point to a common-js module in package.json's "main" field #970
Comments
Did you find a work around for this? |
I think the right thing here will be to have main point to dist/adapter_core.js (which is the es5-transpiled version). @cam-narzt can you check that fixes the problem even in whatever production app you have? |
When I set
|
A workaround I am using is to create an empty file at |
@cam-narzt Sorry, I am not very familiar with the structure, where the |
points main in package.json to the es5-transpiled version of adapter. Partial fix for #970
Hrm... setting it to the transpiled version (which is part of the dist) seems to resolve the ES6 error at least. The new error seems to go into the safari shim, are you testing using Safari or is this with phantomjs? |
@fippo it's the Jest test framework running on Node.js, I honestly don't know how it works internally. |
points main in package.json to the es5-transpiled version of adapter. Partial fix for #970
should be fixed now |
Versions affected
Browser name including version (e.g. Chrome 64.0.3282.119)
N/A (testing environment).
adapter.js (e.g. 6.1.0)
webrtc-adapter
node module version 7.2.3Description
The
main
field inpackage.json
does not point to a common-js module, rather an es6 module. This means that components that import it cannot be tested in acreate-react-app
app without "ejecting" the app, which is a lot of work.More discussion here: facebook/create-react-app#7100
Steps to reproduce
run create-react-app to make a boiletplate project:
npx create-react-app test && cd test
add webrtc-adapter npm module to project:
npm install webrtc-adapter
add adapter to a component:
echo "import adapter from 'webrtc-adapter';" | cat - src/App.js | tee src/App.js
write a basic test which tests the component that imported 'webrtc-adapter' (done already for you in boilerplate)
run tests
npm test
Expected results
tests run
Actual results
tests blow up because the environment doesn't compile the es6 module to a common-js module.
The text was updated successfully, but these errors were encountered: