代码拉取完成,页面将自动刷新
同步操作将从 healthy/ajax-hook 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
/**
* Created by du on 16/9/24.
*/
let path = require('path');
let webpack = require('webpack');
let env = process.argv[2] || "dev"
console.log(env)
let entry = {
"ajaxhook": "./index.js",
}
let plugins = [];
var output={
path: path.resolve("./dist/")
}
if (env === "test") {
entry = {
"es": "./test/es.js",
'hook': './test/hook.js',
'proxy': './test/proxy.js'
}
output = {
path: path.resolve("./test/dist"),
filename: "[name].js"
}
} else if (env === "cdn") {
entry = {
"ajaxhook": "./src/cdn.js",
"ajaxhook.core": "./src/cdn-core.js",
}
output.filename = "[name].js"
output.libraryTarget = 'window'
} else if (env === "cdn-min") {
entry = {
"ajaxhook": "./src/cdn.js",
"ajaxhook.core": "./src/cdn-core.js",
// "ajaxhook": "./src/xhr-proxy.js",
// "ajaxhook.core": "./src/xhr-hook.js",
}
output.filename = "[name].min.js"
output.libraryTarget = 'window'
plugins.push(new webpack.optimize.UglifyJsPlugin({
// compress: {
// warnings: true
// },
sourceMap: true
}))
}
else if (env === "umd") {
output.libraryTarget = "umd"
output.filename = "[name].umd.js"
}else if (env === "umd-min") {
output.libraryTarget = "umd"
output.filename = "[name].umd.min.js"
plugins.push(new webpack.optimize.UglifyJsPlugin({
// compress: {
// warnings: true
// },
sourceMap: true
}))
}
let config = {
devtool: env.endsWith('min')?'source-map':'none',
entry: entry,
output: output,
module: {
rules: [
{
test: /\.js$/,
include: [path.resolve('./src'), path.resolve('./test'), path.resolve('./index.js')],
use: [
{
loader: "babel-loader",
options: {
presets: ['es2015']
}
},
]
}
]
},
watch: true,
watchOptions: {
ignored: '**/node_modules',
},
plugins: plugins
}
webpack(config, function (err, stats) {
if (err) throw err;
process.stdout.write(stats.toString({
colors: true,
modules: false,
children: false,
chunks: false,
chunkModules: false
}) + '\n')
});
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。