私は開発中の反応アプリケーションを持っていますが、私はwebpackにあまり慣れていません。私はいくつかのカスタムJavaScriptでブートストラップテーマを実装しました。私のindex.html
ボディにすべてのスクリプトを手動でリンクするとうまくいきます。Webpack:バンドルにJSファイルのフォルダを追加する方法
ハック方法は非常に乱雑で、後ですべてのスクリプトを小さくすることになります。
私のすべてのスクリプトは、src
にあるvendor
という単一のフォルダにあります。 vendor
フォルダ内のすべてのファイルを、webpackにバンドルされている他のものとバンドルするにはどうすればよいですか?
は、ここに参照のための私のWebPACKファイルです:
const debug = process.env.NODE_ENV !== "production"
const webpack = require('webpack')
const ExtractTextPlugin = require("extract-text-webpack-plugin")
const path = require('path')
const loaders = require('./webpack.loaders')
module.exports = {
context: path.resolve(__dirname, "src"),
resolve: {
root: [ path.resolve(__dirname, "src")],
extensions: ['', '.js', '.jsx']
},
devtool: debug ? "inline-sourcemap" : null,
entry: "./js/client.js",
module: {
loaders: loaders.concat([
{
test: /\.js?$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader',
query: {
presets: ['react', 'es2015', 'stage-0'],
plugins: ['react-html-attrs', 'transform-class-properties', 'transform-decorators-legacy']
}
}
])
},
output: {
path: __dirname + "/src/",
filename: "client.min.js"
},
plugins:
debug ? [] : [
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({ mangle: false, sourcemap: false })
]
}