Webpack uygulamasında, webpack binary'sini çalıştıran ve index.html in/app öğesini/dist dizinine kopyalayan "npm run build" tarafından tetiklenen temel bir oluşturma işlemine sahibim. Ne zaman ben npm run build
koştum ReferenceError: webpack is not defined
olsun ama webpack-dev sunucusunu başlatan npm start
çalıştırdığımda, her şey yolunda.ReferenceError: webpack tanımlı değil
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var config = {
context: __dirname + '/app',
entry: './index.js',
output: {
path: __dirname + '/app',
filename: 'app.js'
},
module: {
loaders: [
{ test: /\.js$/, loader: 'babel', exclude: /node_modules/ },
{ test: /\.html$/, loader: 'raw', exclude: /node_modules/ },
{ test: /\.scss$/, loader: ExtractTextPlugin.extract('style', 'css!sass'), exclude: /node_modules/}
]
},
plugins: [
new ExtractTextPlugin('app.css')
]
};
if (process.env.NODE_ENV == 'production') {
config.output.path = __dirname + '/dist';
config.plugins.push(new webpack.optimize.UglifyJsPlugin());
}
module.exports = config;
Ayrıca çalıştırmak zorunda kaldım: npm install --save webpack' –