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

Unexpected token import #3

Open
xereda opened this issue Oct 25, 2016 · 9 comments
Open

Unexpected token import #3

xereda opened this issue Oct 25, 2016 · 9 comments

Comments

@xereda
Copy link

xereda commented Oct 25, 2016

In VueJS 2.0, the following error occurred:

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

I wait for a return. Tks.

@fundon
Copy link
Member

fundon commented Oct 25, 2016

Do you use webpack?

@xereda
Copy link
Author

xereda commented Oct 25, 2016

Yeah.

@xereda
Copy link
Author

xereda commented Oct 25, 2016

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
#3 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ANrHOqsB6rg09gROacLuHhu4_mgiRD7Vks5q3g8GgaJpZM4Kf1j3
.

@gary149
Copy link
Contributor

gary149 commented Oct 25, 2016

@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

@xereda
Copy link
Author

xereda commented Oct 25, 2016

OK.

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

@fundon
Copy link
Member

fundon commented Oct 26, 2016

@xereda
Copy link
Author

xereda commented Oct 26, 2016

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

@gary149
Copy link
Contributor

gary149 commented Oct 26, 2016

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

@xereda
Copy link
Author

xereda commented Oct 28, 2016

Okay, but imported individually each vue component.

Tks.

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