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

Module Parse Failed #106

Closed
gelinger777 opened this issue Nov 13, 2019 · 9 comments
Closed

Module Parse Failed #106

gelinger777 opened this issue Nov 13, 2019 · 9 comments
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@gelinger777
Copy link

Any ideas why this error happens?

ERROR in ./node_modules/tiptap-vuetify/dist/bundle-esm.js Module parse failed: Unexpected token (4925:17) You may need an appropriate loader to handle this file type. | render(h, context) { | const data = { | props: { ...context.props, | name | }, @ ./resources/js/app.js 50:0-53 @ multi ./resources/js/app.js ./resources/sass/app.scss ./resources/sass/app-rtl.scss

@iliyaZelenko iliyaZelenko added the question Further information is requested label Nov 13, 2019
@iliyaZelenko
Copy link
Owner

iliyaZelenko commented Nov 13, 2019

This error does not apply to this package, it is related to the webpack.

Apparently you do not have a webpack loader for .js extension.

Maybe this will help you: https://webpack.js.org/loaders/babel-loader/

Maybe you have exclude in your webpack loader for node_modules, see this issue.

@gelinger777
Copy link
Author

gelinger777 commented Nov 14, 2019

I am using Laravel's standard loader. I think it has already babel. Need to check what's wrong.

@iliyaZelenko
Copy link
Owner

@gelinger777 Interesting. It seems not only you have such a problem: iliyaZelenko/tiptap-vuetify-nuxt#3 (comment). Maybe my answer will be useful to you.

@iliyaZelenko iliyaZelenko added the help wanted Extra attention is needed label Nov 14, 2019
@gelinger777
Copy link
Author

gelinger777 commented Nov 16, 2019

{
  "private": true,
  "scripts": {
    "dev": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
    "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
  },
  "dependencies": {
    "axios": "^0.18",
    "bootstrap": "^4.1.1",
    "collect.js": "^4.16.6",
    "colyseus.js": "^0.11.5",
    "cross-env": "^5.1",
    "jquery": "^3.2",
    "laravel-echo": "^1.5.4",
    "laravel-mix": "^2.0",
    "lodash": "^4.17.15",
    "moment": "^2.10.6",
    "popper.js": "^1.12",
    "promise": "^7.1.1",
    "pusher-js": "^5.0.1",
    "rtlcss": "^2.2",
    "sweetalert": "^1.1.3",
    "tiptap": "^1.26.4",
    "tiptap-extensions": "^1.28.4",
    "tiptap-vuetify": "^2.8.0",
    "urijs": "^1.17.0",
    "vue": "2.*",
    "vue-drag-resize": "^1.3.2",
    "vue-icon-picker": "^1.0.0",
    "vue-spinners": "^1.0.2",
    "vue-svgicon": "^3.2.6",
    "vue-youtube": "^1.4.0",
    "vue-youtube-embed": "^2.2.2",
    "vuejs-dialog": "^1.4.1",
    "vuetify": "^2.1.3",
    "vuex": "^3.1.1"
  },
  "devDependencies": {
    "@fortawesome/fontawesome-free": "^5.11.2",
    "vuex-undo-redo": "^1.1.4"
  }
}

Here is my package.json.

I will check the link. Thank you.

@iliyaZelenko
Copy link
Owner

I wonder what version of Node.js you have installed? Laravel-mix requires >=8.9.0. Perhaps updating the version will solve the problem.

Sorry again for the inconvenience. You have an unusual problem.

@gelinger777
Copy link
Author

@iliyaZelenko thank you, I will try to figure out on my own. I think the problem could be the NVM not NPM .

Closing for now.

@fredekiel
Copy link

@gelinger777 Did you figure it out?

@fredekiel
Copy link

I was (am) struggling with this exact error message. I have a SPA within my laravel project and I'm therefore using laravel mix (version 2.1.14) to compile my assets.

The error disappears with version 5 of laravel mix, but there's some issues with dynamic imports rendering the final .css files empty. According to Jeffrey this will get fixed once webpack 5 is released.

My workaround so far:

  1. Update laravel mix to version 5
  2. npm Install node-sass
  3. npm install --save node-sass-import
  4. Create a new script in package.json to compile sass files after running laravel-mix
  5. Remove "presets": ["babel-preset-env"], from .babelrc
{
  "scripts": {
    "app-scss": "node-sass resources/assets/dashboard/sass -o public/css --importer node_modules/node-sass-import",
  }
}

To use the fix:

  1. Run npm run production (Or dev/watch)
  2. Run npm run app-scss (Compile the app.css after compiling with mix)

My full package.json

{
  "private": true,
  "scripts": {
    "dev": "npm run development",
    "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch": "npm run development -- --watch",
    "watch-poll": "npm run watch -- --watch-poll",
    "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
    "prod": "npm run production",
    "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "app-scss": "node-sass resources/assets/dashboard/sass -o public/css",
    "public-scss": "node-sass resources/assets/guest/sass -o public/css"
  },
  "devDependencies": {
    "axios": "^0.18",
    "bootstrap": "^4.0.0",
    "cross-env": "^5.1",
    "jquery": "^3.2",
    "laravel-mix": "^5.0.0",
    "lodash": "^4.17.4",
    "popper.js": "^1.12",
    "resolve-url-loader": "^3.1.0",
    "sass": "^1.23.7",
    "sass-loader": "^8.0.0",
    "vue": "^2.5.17"
  },
  "dependencies": {
    "@fortawesome/fontawesome-pro": "^5.11.2",
    "babel-plugin-syntax-dynamic-import": "^6.18.0",
    "bowser": "^1.9.3",
    "clipboard": "^2.0.4",
    "date-fns": "^1.29.0",
    "jspdf": "^1.5.3",
    "laravel-echo": "^1.5.2",
    "moment": "^2.22.2",
    "node-sass": "^4.13.0",
    "pusher-js": "^4.3.1",
    "quill-emoji": "^0.1.7",
    "tiptap-vuetify": "^2.8.0",
    "vee-validate": "^2.1.0-beta.2",
    "vue-analytics": "^5.16.1",
    "vue-carousel": "^0.18.0",
    "vue-chat-scroll": "^1.3.5",
    "vue-cookies": "^1.5.4",
    "vue-echarts": "^3.1.2",
    "vue-infinite-scroll": "^2.0.2",
    "vue-json-csv": "^1.2.2",
    "vue-quill-editor": "^3.0.6",
    "vue-router": "^3.0.1",
    "vue-stripe-elements-plus": "^0.3.0",
    "vue-template-compiler": "^2.5.17",
    "vue2-dropzone": "^3.5.2",
    "vuetify": "^2.1.9",
    "vuex": "^3.0.1",
    "workbox-webpack-plugin": "^3.6.3"
  }
}

@gelinger777
Copy link
Author

@fredekiel my problem was that I had installed NVM. SO I had to make
nvm use node
and then

npm run watch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants