npm run watch .js error file
See original GitHub issueWhen I run command “npm run watch” or “npm run watch-poll”, the script generates a bugged .js file, and the browser console shows “Uncaught SyntaxError: Invalid or unexpected token”.
If I try to open the js file with Sublime Text (Finder show me Zero KB), seems that the script falls in a never ending loop writing in the js file null and after the compiled js script, null and so on…
No problem running the “npm run watch” with only the scss files or, with the js, running “npm run dev”.
Here’s my configs:
Node: 8.1.4 NPM: 5.5.1 Laravel mix: 1.5.0
Webpack.mix.js:
const {mix} = require('laravel-mix');
const dotenv = require('dotenv-webpack');
mix.webpackConfig({
plugins: [
new dotenv({
path: './.env', // Path to .env file (this is the default)
safe: true // load .env.example (defaults to "false" which does not use dotenv-safe)
})
]
})
.js('./resources/assets/javascripts/app.js', './public/assets/javascripts/web.min.js')
.sass('./resources/assets/stylesheets/main.scss', './public/assets/stylesheets/main.min.css')
.scripts([
'./public/assets/javascripts/web.min.js',
'./node_modules/jquery-migrate/dist/jquery-migrate.min.js',
'./node_modules/jquery.stellar/jquery.stellar.js'
], './public/assets/javascripts/web.min.js'
)
.extract([
'axios',
'jquery',
'lodash',
'vue'
]);
HELP ME!
Issue Analytics
- State:
- Created 6 years ago
- Comments:7
Top Results From Across the Web
npm run watch .js error file · Issue #1278 - GitHub
When I run command "npm run watch" or "npm run watch-poll", the script generates a bugged .js file, and the browser console shows...
Read more >Laravel NPM error "npm run watch " in command line
Laravel's mix.js() takes at least one parameter. In the project root directory look at webpack.mix.js file, and then check mix.js().
Read more >Npm run watch displays error after compiling then stops ...
Most of the time this error means that you have to wrong file permissions on your assets. Make sure they all have the...
Read more >npm-watch
Run scripts from package.json when files change. Common Issues. monorepo setups : In a monorepo setup, npm-watch may fail ...
Read more >How To Fix “Laravel Mix NPM run dev error” - YouTube
This video will help you to solve the annoying “Laravel Mix NPM run dev error ” that you probably have seen before when...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
WORKS FINE! Thanx
why you trying to pack your output script.
web.min.js
it’s not valid code, you shouldn’t do that