collapse icon indicating copy to clipboard operation
collapse copied to clipboard

Unexpected token import

Open xereda opened this issue 9 years ago • 9 comments

In VueJS 2.0, the following error occurred:

index.js?11f0:1 Uncaught SyntaxError: Unexpected token import

I wait for a return. Tks.

xereda avatar Oct 25 '16 10:10 xereda

Do you use webpack?

fundon avatar Oct 25 '16 14:10 fundon

Yeah.

xereda avatar Oct 25 '16 16:10 xereda

Yeah

Em ter, 25 de out de 2016 às 12:15, Fangdun Cai [email protected] escreveu:

Do you use webpack?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/vue-bulma/collapse/issues/3#issuecomment-256047051, or mute the thread https://github.com/notifications/unsubscribe-auth/ANrHOqsB6rg09gROacLuHhu4_mgiRD7Vks5q3g8GgaJpZM4Kf1j3 .

xereda avatar Oct 25 '16 19:10 xereda

@xereda It's because this repo is not ready for production. It does not provide a dist folder with the bundled files. You have the raw files and need to use webpack loaders (babel, .vue, etc...) to build a valid js bundle. That's why it fail on line 1:1 in chrome 'import'... is not valid js

gary149 avatar Oct 25 '16 20:10 gary149

OK.

I am individually importing the component files (.vue files / Collapse.vue and Item.vue). Do you see any problem with that?

xereda avatar Oct 25 '16 20:10 xereda

@xereda See https://github.com/fundon/vue-admin/blob/master/build/webpack.base.conf.js#L60-L65, Maybe it helps you.

fundon avatar Oct 26 '16 02:10 fundon

An error has occurred. Analyze this:

xereda@macminixereda:~/S/d/docmob.portal.vuejs2.0:master$ npm run dev

[email protected] dev /Users/xereda/Sites/docmob.local/docmob.portal.vuejs2.0 node build/dev-server.js

Listening at http://localhost:8080

/Users/xereda/Sites/docmob.local/docmob.portal.vuejs2.0/node_modules/webpack-core/lib/LoadersList.js:58 if(element.loader) return element.loader.split("!"); ^

TypeError: element.loader.split is not a function at getLoadersFromObject (/Users/xereda/Sites/docmob.local/docmob.portal.vuejs2.0/node_modules/webpack-core/lib/LoadersList.js:58:43) at LoadersList. (/Users/xereda/Sites/docmob.local/docmob.portal.vuejs2.0/node_modules/webpack-core/lib/LoadersList.js:78:12) at Array.map (native) at LoadersList.match (/Users/xereda/Sites/docmob.local/docmob.portal.vuejs2.0/node_modules/webpack-core/lib/LoadersList.js:70:19) at /Users/xereda/Sites/docmob.local/docmob.portal.vuejs2.0/node_modules/webpack/lib/NormalModuleFactory.js:111:68 at /Users/xereda/Sites/docmob.local/docmob.portal.vuejs2.0/node_modules/async/lib/async.js:726:13 at /Users/xereda/Sites/docmob.local/docmob.portal.vuejs2.0/node_modules/async/lib/async.js:52:16 at done (/Users/xereda/Sites/docmob.local/docmob.portal.vuejs2.0/node_modules/async/lib/async.js:246:17) at /Users/xereda/Sites/docmob.local/docmob.portal.vuejs2.0/node_modules/async/lib/async.js:44:16 at /Users/xereda/Sites/docmob.local/docmob.portal.vuejs2.0/node_modules/async/lib/async.js:723:17 at /Users/xereda/Sites/docmob.local/docmob.portal.vuejs2.0/node_modules/async/lib/async.js:167:37 at /Users/xereda/Sites/docmob.local/docmob.portal.vuejs2.0/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:29:4 at onResolved (/Users/xereda/Sites/docmob.local/docmob.portal.vuejs2.0/node_modules/enhanced-resolve/lib/Resolver.js:39:10) at /Users/xereda/Sites/docmob.local/docmob.portal.vuejs2.0/node_modules/enhanced-resolve/lib/Resolver.js:123:21 at /Users/xereda/Sites/docmob.local/docmob.portal.vuejs2.0/node_modules/enhanced-resolve/lib/Resolver.js:191:15 at applyPluginsParallelBailResult.createInnerCallback.log (/Users/xereda/Sites/docmob.local/docmob.portal.vuejs2.0/node_modules/enhanced-resolve/lib/Resolver.js:104:30)

npm ERR! Darwin 15.6.0 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "dev" npm ERR! node v6.8.0 npm ERR! npm v3.10.8 npm ERR! code ELIFECYCLE npm ERR! [email protected] dev: node build/dev-server.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] dev script 'node build/dev-server.js'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the docmob.portal.vuejs2.0 package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node build/dev-server.js npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs docmob.portal.vuejs2.0 npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls docmob.portal.vuejs2.0 npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request: npm ERR! /Users/xereda/Sites/docmob.local/docmob.portal.vuejs2.0/npm-debug.log

xereda avatar Oct 26 '16 10:10 xereda

Init a new app localy with vue-cli then check the webpack config files to understand

gary149 avatar Oct 26 '16 21:10 gary149

Okay, but imported individually each vue component.

Tks.

xereda avatar Oct 28 '16 17:10 xereda