Vedo un errore nel webpack quando provo a eseguire la mia build.errore webpack nel percorso mancante @ multi principale
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
Options.build è true quando è in esecuzione l'attività npm. Ho provato a regolare i percorsi ma non riesco a trovare quale percorso è sbagliato. Dov'è @ multi principale?
Ecco la mia configurazione del pacchetto web.
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()
]
}; }
Can fornisci la struttura del file dell'app? Qual è l'estensione di 'tinymce-comments-plus'? '.js' o' .jsx'? – tcollart
Grazie per la risposta. L'estensione tinymce-comments-plus.js è .js. Per la struttura del file dell'app, npm esegue gli script su /package.json nella directory principale./js/contiene javascript e/conf/contiene il pacchetto web config js./node_modules/contiene tutte le dipendenze di npm./components/ha sottodirectory con componenti .jsx che reagiscono. – Kentaro
Hai trovato soluzioni alternative? –