Sobald ich den folgenden Befehl in cli (cmd) alles laufen ist in Ordnung:Webpack nicht funktioniert, sobald es über npm Skripte Rans
SET NODE_ENV=production webpack --config webpack.config.js
Wenn ich es über npm Skripte nichts passiert laufen - weder ein Oupput noch eine Fehlermeldung. Ich habe versucht, --display-error-details
hinzuzufügen, aber es ist das gleiche.
Denken Sie daran, dass ich auf Windows bin. Hier
ist die webpack.config.js:
var fs = require('fs');
var path = require('path');
var webpack = require('webpack');
// Project configuration
var entries = {
'js/application': ['./app/main']
};
var appPath = path.resolve(__dirname, 'app');
var buildPath = path.join(__dirname, 'build');
var modulesPath = path.resolve(__dirname, 'node_modules');
// We'll bundle some more files for dev purposes, hot-loader and stuff
if (process.env.NODE_ENV != 'production') {
entries = {
'js/application': [
'webpack-hot-middleware/client?https://localhost:3000',
'./app/main',
'./app/styles/main.less'
]
};
}
// Webpack configuration
module.exports =
{
devtool: 'source-map',
entry: entries,
output: {
path: buildPath,
filename: '[name].js'
},
resolve: {
root: [modulesPath, appPath],
extensions: ['', '.js', '.jsx']
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
// needed for UIkit
new webpack.ProvidePlugin({ // http://webpack.github.io/docs/shimming-modules.html
$: "jquery",
jQuery: "jquery",
L:"leaflet"
})
],
module: {
noParse: [],
loaders: [
{
test: /\.jsx?$/,
loader: 'babel',
include: appPath
}, {
test: /\.json/,
loader: "json-loader"
}, {
test: /\.less$/,
loader: 'style!css!less'
}, {
test: /\.(eot|woff|woff2|ttf|svg|png|jpg)$/,
loader: 'url-loader?limit=30000&name=[name]-[hash].[ext]'
}
]
}
};
Hier sind die package.json Skripte:
"scripts": {
"build:webpack": "SET NODE_ENV=production webpack --config webpack.config.js"
},
Danke @Scott. Das war das Problem. Jetzt geht es. BTW in Unix funktioniert es ohne '&&'. –