我想使用Webpack为Heroku上的Django应用程序编译文件,并使用webpack-bundle-tracker
来跟踪webpack-stats.json
中创建的模块。当我在本地运行webpack时,它会编译所有文件并将它们捆绑到输出目录中,没问题。但是当我在Heroku上运行webpack时,它向我显示所有块都被发出,但是没有文件出现在输出目录中。当我检查webpack-stats.json
的内容时,它总是说"status" : "compiling"
。
以下是我webpack.config.js
的内容。
var path = require('path')
var webpack = require('webpack')
var BundleTracker = require('webpack-bundle-tracker')
module.exports = {
context: __dirname,
entry: './assets/js/index',
output: {
path: path.resolve('./assets/bundles/'),
filename: '[name].js',
},
plugins: [
new BundleTracker({filename: './webpack-stats.json'}),
],
module: {
loaders: [
{ test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
presets: ['react']
}
}
]
},
resolve: {
modulesDirectories: ['node_modules', 'bower_components'],
extensions: ['', '.js', '.jsx'],
},
}
我希望webpack在heroku上以与在本地计算机上相同的方式捆绑我的资源。我怎么能做到这一点?