vue-bulma / vue-admin

We are refactoring it, using the latest Vue and Bulma. WIP
9.43k stars 1.61k forks source link

Laravel-mix module parse failed #164

Open gazben opened 7 years ago

gazben commented 7 years ago

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?

fundon commented 7 years ago

Do you use Webpack 2?

gazben commented 7 years ago

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

gazben commented 7 years ago

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?

fundon commented 7 years ago

Try to use import instead of require.

gazben commented 7 years ago

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

.babelrc:

{
  "presets": [
    ["es2015", { "modules": false }]
  ],
  "plugins": ["transform-object-rest-spread"]
}
gazben commented 7 years ago

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

tandrus-mc commented 7 years ago

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

gazben commented 7 years ago

@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.