gpt4 book ai didi

build - webpack 缺少路径@multi main 时出错

转载 作者:行者123 更新时间:2023-12-03 13:27:59 25 4
gpt4 key购买 nike

当我尝试运行我的构建时,我在 webpack 中看到错误。

webpack --config conf/webpack.build.config.js --progress --colors --display-error-details --display-modules --display-reasons
Hash: e633ac8cf3ba9196f876
Version: webpack 1.12.9
Time: 312ms
Asset Size Chunks Chunk Names
tinymce-comments-plus-bundle.js 5.88 kB 0 [emitted] main
[0] multi main 28 bytes {0} [built] [1 error]
[1] ./js/tinymce-comments-plus.js 0 bytes [built] [failed]
single entry ./js/tinymce-comments-plus.js [0] multi main
ERROR in missing path
@ multi main

npm 任务运行时,Options.build 为 true。我尝试过调整路径,但似乎找不到哪条路径是错误的。 @multi main 在哪里?

这是我的 webpack 配置。

module.exports = function( options ) {

var path = require( 'path' ),
cssLoaders = 'style!css',
scssLoaders = cssLoaders + '!sass',
babelLoader = 'react-hot!babel',
webpack = require( 'webpack' ),
ExtractTextPlugin = require( 'extract-text-webpack-plugin' );

function extractLoaders( extract, loaders ) {
return ExtractTextPlugin.extract( extract, loaders.substr( loaders.indexOf( '!' ) ) );
}

if ( options.build ) {
cssLoaders = extractLoaders( 'style', cssLoaders );
scssLoaders = extractLoaders( 'style', scssLoaders );
babelLoader = extractLoaders( 'react-hot', babelLoader );
}


return {
entry: [ './js/tinymce-comments-plus.js' ],
output: {
path: __dirname + '/../js',
publicPath: options.build ? '/dist/' : 'http://localhost:8080/',
filename: 'tinymce-comments-plus-bundle.js',
// hot: true,
// headers: { 'Access-Control-Allow-Origin': '*' }
},
module: {
loaders: [
{
test: /\.css$/,
loader: cssLoaders
},
{
test: /\.scss$/,
loader: scssLoaders
},
{
test: /\.js$/,
exclude: /node_modules/,
loader: babelLoader
},
{
test: /\.jsx$/,
exclude: /node_modules/,
loader: babelLoader
}
]
},
resolve: {
root: [
path.join( __dirname, '..', 'components' ),
path.join( __dirname, '..', 'js' ),
path.join( __dirname, '..', 'sass' ),
],
extensions: [ '', '.js', '.jsx', '.sass', '.scss', '.css' ],
},
plugins: options.build ? [
// build plugins
new ExtractTextPlugin( './css/[name].css' ),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
new webpack.HotModuleReplacementPlugin()
] : [
// dev plugins
new ExtractTextPlugin( './css/[name].css' ),
//new webpack.HotModuleReplacementPlugin()
]
}; }

最佳答案

我遇到了类似的问题,我建议使用 npm install -g webpack 全局安装 webpack,然后链接到全局安装 npm link webpack

此外,请确保您的扩展已链接到 resolve.extensions

resolve: {
extensions: ['', '.ts', '.tsx', '.js'] // <-- Had to add the .js one
}

关于build - webpack 缺少路径@multi main 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34285193/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com