-
-
Notifications
You must be signed in to change notification settings - Fork 114
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
Continued problems with issue #103 ('import' and 'export' may appear only with 'sourceType: module') #294
Comments
Hello, I just ran into the same issue and tried all the options above with no success. I really look forward to a solution. My Browserify command: The output: Browserify: v16.5.2 Nicolas |
Same problem, I tried Babel 7 and 6. After Pinia installation in my Vue project (without vue-cli) and adding Error:
Config:
Build: |
Any update on this issue i am seeing the same when i a, trying to run karma with browserify with babelify |
Did you try adding the extensions: ['.ts', '.js'] to babelify |
Hello. This is a follow up to an existing (but closed) issue (#103). I am having the same issue. I've tried the suggestions in #103, but still cannot resolve the issue (see below). Are the solutions in that issue still relevant, or have they become obsolete?
In my case, the Browserify command is:
node_modules/.bin/browserify www/js/functions.js test/tape.test.js -t [ babelify ] --outfile test/test-bundle.js
It is failing with the error:
SyntaxError: 'import' and 'export' may appear only with 'sourceType: module' (4819:0) while parsing C:\Users\snarl\Orbis\osatest\node_modules\fetch-mock\esm\client.js while parsing file: C:\Users\snarl\Orbis\osatest\node_modules\fetch-mock\esm\client.js
My Attempts To Resolve
--From #103, I tried installing the package
babel-preset-es2015
then running the command:node_modules/.bin/browserify www/js/functions.js test/tape.test.js -t [ babelify --presets [ es2015 ] ] --outfile test/test-bundle.js
The previous error was gone, but it failed with a new error:
Error: Plugin/Preset files are not allowed to export objects, only functions. In C:\Users\snarl\Orbis\osatest\node_modules\babel-preset-es2015\lib\index.js while parsing file: C:\Users\snarl\Orbis\osatest\test\tape.test.js
A few Stack Overflow posts (example) seemed to indicate that this was because I was using
babel-preset-es2015
, and had to eschew it in favor of a different package;@babel/preset-env
I've removed the old package, and installed the new package. But the Browserify command is back to failing with the original import/export error.--With
@babel/preset-env
installed, I tried three different configurations in my project'sbabel.config.js
file (see pastebin here), but none had any effect on the issue. Those suggestions were taken from the @babel/preset-env page.--With
@babel/preset-env
installed, I tried using the following command from the command line, but there was no change in the result.node_modules/.bin/browserify www/js/functions.js test/tape.test.js -t [ babelify --presets [ es2015 ] ] --outfile test/test-bundle.js
--To see the code in each of my JS files, please see this pastebin.
FYI I am using Browserify v16.5.1 and Babelify v10.0.0.
Thanks in advance.
The text was updated successfully, but these errors were encountered: