S
S
Sergey Sokolov2020-01-04 23:25:43
JavaScript
Sergey Sokolov, 2020-01-04 23:25:43

How to understand where the error is when building webpack?

Added to old Vuetify project. It builds in development mode (but the size is under 8Mb). I want to see how it shrinks and I'm trying to build it for sale, in the config with minification. The build passes, but at the very end it crashes with an error. And, already, it seems, after , in fact, the build:

...
       | ./lumen/src/app/videoCategories.js 1.24 KiB [depth 13] [built]
       |     [exports: default]
       |     [all exports used]
       |     harmony side effect evaluation App/videoCategories  ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./lumen/src/components/TovidioOverlayDetails.vue?vue&type=script&lang=js& 50:0-57
       |     harmony import specifier App/videoCategories  ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./lumen/src/components/TovidioOverlayDetails.vue?vue&type=script&lang=js& 143:4-26
       |     + 120 hidden modules
     + 165 hidden modules

LOG from webpack.buildChunkGraph.visitModules
<t> prepare: 46.1219ms
<t> visiting: 3.6636ms

ERROR in unknown: Unexpected token (19114:11)
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] build: `webpack --verbose --config webpack.prod.js`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-01-05T10_05_57_122Z-debug.log

The webpack config is divided into two branches. In addition to the general webpack.common.js, there webpack.dev.jsare webpack.prod.js:
// webpack.prod.js
const merge = require('webpack-merge');
const common = require('./webpack.common.js');
const MinifyPlugin = require("babel-minify-webpack-plugin");

module.exports = merge(common, {

  mode: 'production',
  devtool: 'source-map',
  plugins: [
    new MinifyPlugin(),
  ]
})

What could be the cause of the error, and how to find out exactly where it occurs - in which file is the line 19114?
There is nothing useful in the mentioned log file:
debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'build' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle [email protected]~prebuild: [email protected]
6 info lifecycle [email protected]~build: [email protected]
7 verbose lifecycle [email protected]~build: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~build: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/usr/src/app/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
9 verbose lifecycle [email protected]~build: CWD: /usr/src/app
10 silly lifecycle [email protected]~build: Args: [ '-c', 'webpack --config webpack.prod.js' ]
11 silly lifecycle [email protected]~build: Returned: code: 2  signal: null
12 info lifecycle [email protected]~build: Failed to exec build script
13 verbose stack Error: [email protected] build: `webpack --config webpack.prod.js`
13 verbose stack Exit status 2
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:305:20)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:305:20)
13 verbose stack     at maybeClose (internal/child_process.js:1028:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid [email protected]
15 verbose cwd /usr/src/app
16 verbose Linux 4.9.184-linuxkit
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
18 verbose node v13.5.0
19 verbose npm  v6.13.4
20 error code ELIFECYCLE
21 error errno 2
22 error [email protected] build: `webpack --config webpack.prod.js`
22 error Exit status 2
23 error Failed at the [email protected] build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]

Upd. found by experience. that disabling babel-minify-webpack-pluginfixes the error. Those. error during minification step via Babel Minify Webpack plugin

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vann Damm, 2020-01-09
@effect_tw

i.e. it turns out that you need to remove babel minify. And if I need it, then how to solve the problem?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question