Skip to content
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

'import' and 'export' may only appear at the top level (45:0) in process-es6/browser.js #1

Open
notpushkin opened this issue Mar 16, 2016 · 9 comments

Comments

@notpushkin
Copy link

Hello!

I get this weird error when I activate rollup-plugin-node-globals:

SyntaxError: 'import' and 'export' may only appear at the top level (45:0) in project_root/node_modules/rollup-plugin-node-globals/node_modules/process-es6/browser.js
    at Parser.pp.raise (project_root/node_modules/rollup-plugin-node-globals/node_modules/rollup-plugin-inject/node_modules/acorn/dist/acorn.js:943:13)

What could have gone wrong?

@calvinmetcalf
Copy link
Owner

you are using in conjunction with the commonjs plugin which is mistaking it for a commonjs file that needs to be transpiled, assuming you're just using process, you should add the ignoreGlobals flag as soon as the version that supports it is published.

@calvinmetcalf
Copy link
Owner

I believe v1.0.3 should work the current commonjs plugin, so you should be able to use that between now and the commonjs version getting updated

@notpushkin
Copy link
Author

OK, thanks for the advices! Installing the git master version of plugin-commonjs worked too (I don't think it's a good solution for production, but I hope that a new release is coming out soon).

@tyler-johnson
Copy link

Any ETA on this?

Also 1.0.3 does not seem to work with [email protected]. Is there another version combination I can try?

@calvinmetcalf
Copy link
Owner

I have no control nor knowledge of when their going to publish that, and 1.0.3 should work, what issue do you get?

@tyler-johnson
Copy link

It's the same issue:

'import' and 'export' may only appear at the top level (2:0) in /Users/tyler/Development/temple/node_modules/rollup-plugin-node-globals/src/global.js

However it could be an environment specific thing. I will try rearranging plugins to see what happens.

@tyler-johnson
Copy link

Although now I'm thinking that it is not the same issue since the file paths are different. It is very strange that my config file imports are pulling straight from the src/ folder.

@calvinmetcalf
Copy link
Owner

yeah just put that file in your excludes from the commonjs plugin

On Tue, Mar 29, 2016 at 2:25 PM Tyler Johnson [email protected]
wrote:

Although now I'm thinking that it is not the same issue since the file
paths are different. It is very strange that my config file imports are
pulling straight from the src/ folder.


You are receiving this because you commented.

Reply to this email directly or view it on GitHub
#1 (comment)

@tyler-johnson
Copy link

Yep that was the fix! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants