1 hidden module
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! duo-office@1.0.0 build: webpack -p --progress --colors
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the duo-office@1.0.0 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! /Users/mac/.npm/_logs/2018-09-12T13_10_31_200Z-debug.log
var webpack = require('webpack'); var path = require('path');
// variables var isProduction = process.argv.indexOf('-p') >= 0 || process.env.NODE_ENV === 'production'; var sourcePath = path.join(dirname, './src'); var outPath = path.join(dirname, './dist/static'); var appPath = path.join(sourcePath, '/app'); var commonPath = path.join(sourcePath, '/common'); var servicePath = path.join(sourcePath, '/service'); var antdPath = path.join(sourcePath, '/library/ant-design/components'); var langPath = path.join(sourcePath, '/app/assets/localLang'); var errCodeFnPath = path.join(sourcePath, '/app/utils/errCodeFn.ts');
// plugins var HtmlWebpackPlugin = require('html-webpack-plugin'); var MiniCssExtractPlugin = require('mini-css-extract-plugin'); var WebpackCleanupPlugin = require('webpack-cleanup-plugin'); const CopyWebpackPlugin = require('copy-webpack-plugin');
// 配置 HappyPack var HappyPack = require('happypack'), os = require('os'), happyThreadPool = HappyPack.ThreadPool({ size: os.cpus().length })
module.exports = { context: sourcePath, entry: { app: './main.tsx' }, output: { path: outPath, filename: 'bundle.js', chunkFilename: '[hash]/[chunkhash].js', publicPath: isProduction ? '/static/' : '' }, target: 'web', resolve: { extensions: ['.js', '.ts', '.tsx'], mainFields: ['module', 'browser', 'main'], alias: { app: appPath, common: commonPath, service: servicePath, antd: antdPath, Lang: langPath, errCodeFn: errCodeFnPath } }, resolveLoader: { modules: ['node_modules', 'tools'] }, module: { // loaders: [ // { // test: /.js|jsx$/, // loader: 'HappyPack/loader?id=jsHappy', // exclude: /node_modules/ // } // ], rules: [ { test: /.tsx?$/, use: [ isProduction && { loader: 'babel-loader', options: { plugins: ['react-hot-loader/babel'] } }, 'ts-loader', { loader: 'ui-loader', options: { 'lib': 'antd', 'camel2': '-', 'style': 'style/index.less' } }, 'happypack/loader' ].filter(Boolean) }, { test: /.less$/, use: [ { loader: 'style-loader' }, { loader: 'css-loader', options: { sourceMap: true, modules: true, localIdentName: '[local]___[hash:base64:5]' } }, { loader: 'less-loader' } ], include: [appPath] }, { test: /.css$/, use: [ { loader: 'style-loader' }, { loader: 'css-loader', options: { modules: false } }, { loader: 'less-loader' } ], include: [appPath] }, { test: /.less$/, use: [ { loader: 'style-loader' }, { loader: 'css-loader' }, { loader: 'less-loader', options: { javascriptEnabled: true } } ], exclude: [appPath] }, { test: /.(png|svg)$/, use: 'url-loader?limit=10000' }, { test: /.(jpg|gif)$/, use: 'file-loader' } ] }, optimization: { splitChunks: { name: true, cacheGroups: { commons: { chunks: 'initial', minChunks: 2 }, vendors: { test: /[\/]node_modules[\/]/, chunks: 'all', priority: -10 } } }, runtimeChunk: true }, plugins: [ new webpack.EnvironmentPlugin({ NODE_ENV: 'development', DEBUG: false }), new WebpackCleanupPlugin(), new MiniCssExtractPlugin({ filename: '[contenthash].css', disable: !isProduction }), new HtmlWebpackPlugin({ title: 'DuoOffice', filename: isProduction ? '../index.html' : 'index.html', template: 'pug-loader!src/index.jade' }),
], devServer: { contentBase: sourcePath, hot: true, inline: true, historyApiFallback: { disableDotRule: true }, disableHostCheck: true,
}, node: { fs: 'empty', net: 'empty' } };
![Uploading 1.png…]() 14 | 15 | ReactDOM.render(
Child html-webpack-plugin for "../index.html": 1 asset Entrypoint undefined = ../index.html [0] ../node_modules/pug-loader!./index.jade 1.09 KiB {0} [built] [2] external "fs" 42 bytes {0} [optional] [built]
webpack -p --progress --colors
npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the duo-office@1.0.0 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! /Users/mac/.npm/_logs/2018-09-12T13_10_31_200Z-debug.log