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

Created on 7 Feb 2018  路  5Comments  路  Source: parcel-bundler/parcel

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

Most helpful comment

Solved. Successfully built.
screenshot_1

All 5 comments

I also got this error.
parcel-plugin-vue is installed, but in my app.vue , it throws 'import' and 'export' may only appear at the top level

Solved. Successfully built.
screenshot_1

@limitedeternity Plain Text would have been nice for quick copy/paste. ;)

@wtfuii

.babelrc:

{
  "presets": [
    "env",
    "stage-0"
  ],
  "plugins": [
    "transform-vue-jsx",
    "transform-runtime",
    "syntax-dynamic-import"
  ]
}

Seems to be a misconfigured babel

Was this page helpful?
0 / 5 - 0 ratings