vue-admin icon indicating copy to clipboard operation
vue-admin copied to clipboard

Laravel-mix module parse failed

Open gazben opened this issue 7 years ago • 8 comments

When I try to use the application for a project a get Unexpected token

Environment:

windows 10 / linux mint 18
node -v
v7.7.0
npm -v
4.1.2

I include the module to my project: require('../../../node_modules/vue-admin/client');

Then:

npm run dev

 error  in ./~/vue-admin/client/app.js

Unexpected token (38:2)
You may need an appropriate loader to handle this file type.
|   store,
|   nprogress,
|   ...App
| })

How can I use this project with laravel mix / webpack?

gazben avatar Mar 01 '17 18:03 gazben

Do you use Webpack 2?

fundon avatar Mar 01 '17 22:03 fundon

Yes, laravel-mix uses webpack2: https://github.com/JeffreyWay/laravel-mix/blob/master/package.json

gazben avatar Mar 01 '17 22:03 gazben

The problem is with the spread operator. More info can be found here: #https://github.com/JeffreyWay/laravel-mix/issues/76

Still can't get it to compile, but now we have the exact issue. Is it possible, that during compilation the babelrc is overwritten with the local babelrc?

gazben avatar Mar 02 '17 10:03 gazben

Try to use import instead of require.

fundon avatar Mar 04 '17 01:03 fundon

If you mean: import "vue-admin/client"; Still gives the error.

.babelrc:

{
  "presets": [
    ["es2015", { "modules": false }]
  ],
  "plugins": ["transform-object-rest-spread"]
}

gazben avatar Mar 04 '17 13:03 gazben

I spent a lot of time to fix this issue, and I failed. A made the laravel integration without laravel mix. https://github.com/gazben/laravel-vue-admin

gazben avatar Mar 08 '17 14:03 gazben

@gazben I'm curious to ask why you set up the laravel integration as you did, why all the symlinks?

tandrus-mc avatar Apr 05 '17 08:04 tandrus-mc

@tandrus-mc I put way too much time into the integration, and I needed something asap to put in one repository and works. It was a wild idea but it worked.

gazben avatar Apr 06 '17 17:04 gazben