自更新以来,Laravel Mix将无法在生产模式下构建

时间:2020-10-06 15:34:04

标签: webpack laravel-mix

我正在非Laravel项目中运行Laravel mix,只是为了编译一些sass + js。

它工作正常,仍然处于npm run dev模式,但是npm run prod崩溃了:

> aah@1.0.0 prod /var/www/path/to/aah
> cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --config=node_modules/laravel-mix/setup/webpack.config.js

 ERROR  Failed to compile with 2 errors15:50:46

 error  in ./src/bootstrap.scss

Module build failed (from ./node_modules/css-loader/index.js):
ModuleBuildError: Module build failed (from ./node_modules/css-loader/index.js):
Unclosed string (11:115694)

(removed a couple of massively long lines of compiled CSS!)

  at /var/www/.../aah/node_modules/webpack/lib/NormalModule.js:316:20                                                                    
      at /var/www/.../aah/node_modules/loader-runner/lib/LoaderRunner.js:367:11                                                              
      at /var/www/.../aah/node_modules/loader-runner/lib/LoaderRunner.js:233:18                                                              
      at context.callback (/var/www/.../aah/node_modules/loader-runner/lib/LoaderRunner.js:111:13)                                           
      at Object.<anonymous> (/var/www/.../aah/node_modules/css-loader/lib/loader.js:44:18)                                                   
      at /var/www/.../aah/node_modules/css-loader/lib/processCss.js:214:4                                                                    

这是我的webpack.mix.js文件

let mix = require('laravel-mix');
mix.js('src/bootstrap.js', 'aah/js/')    
  .js('src/aah.js', 'aah/js/')           
  .sass('src/bootstrap.scss', 'aah/css/')
  .sass('src/civicrm.scss', 'aah/css/')  

还有packages.json

  "dependencies": {                      
    "bootstrap-sass": "^3.4.1"           
  },                                     
  "devDependencies": {                   
    "cross-env": "^6.0.3",               
    "laravel-mix": "^5.0.5",             
    "node-sass": "^4.14.1",              
    "resolve-url-loader": "^3.1.1",      
    "sass-loader": "^8.0.2",             
    "vue-template-compiler": "^2.6.12"   
  }                                      

0 个答案:

没有答案