我有一個問題,我包括一個jQuery插件(jquery.jplayer.js
)和webpack正在加載該插件的依賴關係在同一個文件中,在這種情況下它是jQuery。我想通過CDN提供jQuery,所以顯然我不希望jQuery在本地加載。我已經縮小到這行代碼define(['jquery'], factory); // jQuery Switch
。webpack不加載依賴關係
如何告訴webpack不包含它在.js
文件中找到的依賴關係?
var debug = process.env.NODE_ENV !== "production";
var webpack = require("webpack");
var path = require("path");
module.exports = {
context: __dirname,
devtool: debug ? "inline-sourcemap" : null,
entry: {
app: "./wwwroot/js/app.js",
lib: "./wwwroot/lib/jPlayer/dist/jplayer/jquery.jplayer.js"
},
module: {
loaders: [
{
test: /\.jsx?$/,
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: "./wwwroot/build/",
filename: "[name].js"
},
plugins: debug ? [] : [
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({ mangle: false, sourcemap: false })
]
};