question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

try bundle with vue: 'import' and 'export' may only appear at the top level

See original GitHub issue

Choose one: is this a πŸ› bug report or πŸ™‹ feature request? a πŸ› bug report

πŸŽ› Configuration (.babelrc, package.json, cli command)

.babelrc

{
  "presets": [
    ["es2015"]
  ]
}

πŸ€” Expected Behavior

Build pass

😯 Current Behavior

Not passed

πŸ’ Possible Solution

Maybe because of babel?

πŸ”¦ Context

I’m using parcel + vue-compiler with vue single file temeplate

πŸ’» Code Sample

🌍 Your Environment

Software Version(s)
Parcel 1.51
Node 9.6.0
npm/Yarn 5.3.0
Operating System windows10

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
limitedeternitycommented, Feb 13, 2018

Solved. Successfully built. screenshot_1

1reaction
limitedeternitycommented, Apr 8, 2018

@wtfuii

.babelrc:

{
  "presets": [
    "env",
    "stage-0"
  ],
  "plugins": [
    "transform-vue-jsx",
    "transform-runtime",
    "syntax-dynamic-import"
  ]
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

'import' and 'export' may only appear at the top level
'import' and 'export' may only appear at the top level. This means that webpack is bundling the non-transpiled ES6 code, which is why...
Read more >
'import' and 'export' may only appear at the top level Β· Issue #304
Bundling worked with lodash-es without any issues till v. 11.0.2 . Actual Behavior !] Error: 'import' and 'export' may only appear at the...
Read more >
import' and 'export' may only appear at the top level-Vue.js
I am using Webpack 2.2.0 to bundle my React JS modules. Encountered a similar issue while importing modules in my main app.js file....
Read more >
'import' and 'export' may only appear at the top level - SyntaxFix
I'm using webpack with vuejs. Webpack does its thing, but when I look at the outputted app.js file, it gives me this error....
Read more >
How to fix: import and export may only appear at the top level
Solution: Downgrade @rollup/plugin-commonjs to 11.0.2. I've had to downgrade the module library version. Just run this command in your terminal: npm i -D...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found