Я пытаюсь создать пакетные файлы js и css из моего реактивного проекта, и я использую UMD. Я сталкиваюсь с ошибкой всякий раз, когда я запускаю «сборку запуска пряжи»
У меня есть это в моем пакете. json scripts
:
"scripts": {
...
"build": "cross-env NODE_OPTIONS=--max_old_space_size=8192 nwb build-react-component"
...
},
Когда я попробуйте запустить сборку пряжи, но я получаю эту ошибку:
× Creating UMD builds
Error running command: Build failed with errors.
Error: Build failed with errors.
at compiler.run (C:\Source\planbox-self-driving\list_view\listViewProject\node_modules\nwb\lib\webpackBuild.js:78:17)
at finalCallback (C:\Source\planbox-self-driving\list_view\listViewProject\node_modules\nwb\node_modules\webpack\lib\Compiler.js:257:39)
at hooks.done.callAsync.err (C:\Source\planbox-self-driving\list_view\listViewProject\node_modules\nwb\node_modules\webpack\lib\Compiler.js:273:13)
at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Source\planbox-self-driving\list_view\listViewProject\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:15:1)
at AsyncSeriesHook.lazyCompileHook (C:\Source\planbox-self-driving\list_view\listViewProject\node_modules\tapable\lib\Hook.js:154:20)
at onCompiled (C:\Source\planbox-self-driving\list_view\listViewProject\node_modules\nwb\node_modules\webpack\lib\Compiler.js:271:21)
at hooks.afterCompile.callAsync.err (C:\Source\planbox-self-driving\list_view\listViewProject\node_modules\nwb\node_modules\webpack\lib\Compiler.js:681:15)
at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Source\planbox-self-driving\list_view\listViewProject\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:6:1)
at AsyncSeriesHook.lazyCompileHook (C:\Source\planbox-self-driving\list_view\listViewProject\node_modules\tapable\lib\Hook.js:154:20)
at compilation.seal.err (C:\Source\planbox-self-driving\list_view\listViewProject\node_modules\nwb\node_modules\webpack\lib\Compiler.js:678:31)
at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Source\planbox-self-driving\list_view\listViewProject\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:6:1)
at AsyncSeriesHook.lazyCompileHook (C:\Source\planbox-self-driving\list_view\listViewProject\node_modules\tapable\lib\Hook.js:154:20)
at hooks.optimizeAssets.callAsync.err (C:\Source\planbox-self-driving\list_view\listViewProject\node_modules\nwb\node_modules\webpack\lib\Compilation.js:1423:35)
at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Source\planbox-self-driving\list_view\listViewProject\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:6:1)
at AsyncSeriesHook.lazyCompileHook (C:\Source\planbox-self-driving\list_view\listViewProject\node_modules\tapable\lib\Hook.js:154:20)
at hooks.optimizeChunkAssets.callAsync.err (C:\Source\planbox-self-driving\list_view\listViewProject\node_modules\nwb\node_modules\webpack\lib\Compilation.js:1414:32)
error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
также вот мой nwb.config. js
const packageName = require('./package.json').name;
const version = require('./package.json').version;
const webpack = require('webpack');
module.exports = {
type: 'react-component',
npm: {
cjs: false,
esModules: false,
umd: {
global: 'pb.SearchUI',
entry: './ListView.js',
}
},
webpack: {
compat:{
moment:['en-us']
},
extra: {
node: {//Fix for "Module not found: Error: Can't resolve 'net'" caused by joi being used in the browser
net: 'empty',
tls: 'empty',
dns: 'empty'
},
output: {
filename: (chunkData) => {
return chunkData.chunk.name === 'main' ? (packageName+'-'+version+'.js') : '[name]/[name].js';
},
path: __dirname + '/umd',
libraryTarget: 'umd'
},
plugins: [
// Ignore all locale files of moment.js
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
new webpack.IgnorePlugin(/^\.\/locale$/, /moment-timezone$/),
],
},
extractCSS: {
filename: process.env.NODE_ENV === 'production' ? (packageName+'-'+version+'.css') : '[name].css',
path: __dirname +'/umd'
}
}
};
Кто-нибудь знает, в чем проблема?