我在 webpack 中运行构建生产时遇到问题。但是当我使用 dev-server 运行时,更多的代码不会出错。请帮忙..我必须完成我的最后一个项目,它必须在生产模式下运行良好。我希望我能从你们那里得到解决方案。
这是我在运行构建时的错误:
/MovieDB/node_modules/jest-worker/build/WorkerPool.js:25
} catch {
^
SyntaxError: Unexpected token {
at NativeCompileCache._moduleCompile (/home/donquixote/Desktop/dicoding-submission/MovieDB/node_modules/v8-compile-cache/v8-compile-cache.js:240:18)
at Module._compile (/home/donquixote/Desktop/dicoding-submission/MovieDB/node_modules/v8-compile-cache/v8-compile-cache.js:186:36)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
...
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Run Code Online (Sandbox Code Playgroud)
这是我的 webpack.common.js:
const path = require('path');
const webpack = require('webpack');
const HtmlPackPlugin = require('html-webpack-plugin');
const terserPlugin = require('terser-webpack-plugin');
module.exports = {
entry: './src/index.js',
output: { …Run Code Online (Sandbox Code Playgroud)