2019-01-19 04:46:40 +07:00
|
|
|
const path = require("path");
|
|
|
|
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
|
|
|
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
|
|
|
|
const PreloadWebpackPlugin = require("preload-webpack-plugin");
|
2019-01-24 06:44:57 +07:00
|
|
|
const root = path.resolve(__dirname, "../..");
|
|
|
|
const fills = path.join(root, "packages/ide/src/fill");
|
|
|
|
const vsFills = path.join(root, "packages/vscode/src/fill");
|
2019-01-19 04:46:40 +07:00
|
|
|
|
|
|
|
const merge = require("webpack-merge");
|
|
|
|
|
|
|
|
module.exports = merge({
|
|
|
|
devtool: "source-map",
|
|
|
|
entry: "./packages/web/src/index.ts",
|
|
|
|
output: {
|
|
|
|
chunkFilename: "[name]-[hash:6].bundle.js",
|
|
|
|
path: path.join(root, "dist"),
|
|
|
|
filename: "[hash:6].bundle.js",
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [{
|
|
|
|
loader: "string-replace-loader",
|
|
|
|
test: /\.(j|t)s/,
|
|
|
|
options: {
|
|
|
|
multiple: [{
|
|
|
|
search: "require\\.toUrl\\(",
|
|
|
|
replace: "requireToUrl(",
|
|
|
|
flags: "g",
|
|
|
|
}, {
|
|
|
|
search: "require\\.__\\$__nodeRequire",
|
|
|
|
replace: "require",
|
|
|
|
flags: "g",
|
|
|
|
}, {
|
|
|
|
search: "\\.attributes\\[([^\\]]+)\\] = ([^;]+)",
|
|
|
|
replace: ".setAttribute($1, $2)",
|
|
|
|
flags: "g",
|
|
|
|
}],
|
|
|
|
},
|
|
|
|
}],
|
|
|
|
},
|
2019-01-19 07:04:24 +07:00
|
|
|
node: {
|
|
|
|
module: "empty",
|
|
|
|
crypto: "empty",
|
|
|
|
tls: "empty",
|
|
|
|
},
|
2019-01-19 04:46:40 +07:00
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
"gc-signals": path.join(fills, "empty.ts"),
|
|
|
|
"selenium-webdriver": path.join(fills, "empty.ts"),
|
|
|
|
"vscode": path.join(fills, "empty.ts"),
|
|
|
|
"vscode-fsevents": path.join(fills, "empty.ts"),
|
|
|
|
"vsda": path.join(fills, "empty.ts"),
|
|
|
|
"windows-foreground-love": path.join(fills, "empty.ts"),
|
|
|
|
"windows-mutex": path.join(fills, "empty.ts"),
|
|
|
|
"windows-process-tree": path.join(fills, "empty.ts"),
|
|
|
|
"vscode-sqlite3": path.join(fills, "empty.ts"),
|
|
|
|
"tls": path.join(fills, "empty.ts"),
|
|
|
|
"native-is-elevated": path.join(fills, "empty.ts"),
|
2019-01-19 07:04:24 +07:00
|
|
|
"native-watchdog": path.join(fills, "empty.ts"),
|
|
|
|
"dns": path.join(fills, "empty.ts"),
|
|
|
|
"console": path.join(fills, "empty.ts"),
|
|
|
|
"readline": path.join(fills, "empty.ts"),
|
2019-01-19 04:46:40 +07:00
|
|
|
|
|
|
|
"crypto": "crypto-browserify",
|
|
|
|
"http": "http-browserify",
|
|
|
|
|
|
|
|
"child_process": path.join(fills, "child_process.ts"),
|
|
|
|
"os": path.join(fills, "os.ts"),
|
|
|
|
"fs": path.join(fills, "fs.ts"),
|
|
|
|
"net": path.join(fills, "net.ts"),
|
|
|
|
"util": path.join(fills, "util.ts"),
|
|
|
|
"electron": path.join(fills, "electron.ts"),
|
|
|
|
|
|
|
|
"native-keymap": path.join(vsFills, "native-keymap.ts"),
|
|
|
|
"node-pty": path.join(vsFills, "node-pty.ts"),
|
|
|
|
"graceful-fs": path.join(vsFills, "graceful-fs.ts"),
|
|
|
|
"spdlog": path.join(vsFills, "spdlog.ts"),
|
2019-01-24 06:44:57 +07:00
|
|
|
"iconv-lite": path.join(vsFills, "iconv-lite.ts"),
|
2019-01-19 04:46:40 +07:00
|
|
|
|
|
|
|
"vs/base/node/paths": path.join(vsFills, "paths.ts"),
|
|
|
|
"vs/base/common/amd": path.join(vsFills, "amd.ts"),
|
|
|
|
"vs/platform/node/product": path.join(vsFills, "product.ts"),
|
|
|
|
"vs/platform/node/package": path.join(vsFills, "package.ts"),
|
|
|
|
"vs": path.join(root, "lib", "vscode", "src", "vs"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
resolveLoader: {
|
|
|
|
alias: {
|
|
|
|
"vs/css": path.join(vsFills, "css.js"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new HtmlWebpackPlugin({
|
|
|
|
template: "packages/web/src/index.html",
|
|
|
|
}),
|
|
|
|
new PreloadWebpackPlugin({
|
|
|
|
rel: "preload",
|
|
|
|
as: "script",
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
target: "web",
|
2019-01-23 02:48:43 +07:00
|
|
|
}, require(path.join(root, "scripts", "webpack.general.config.js"))({
|
|
|
|
typescriptCompilerOptions: {
|
|
|
|
"target": "es5",
|
|
|
|
"lib": ["dom", "esnext"],
|
|
|
|
"importHelpers": true,
|
|
|
|
},
|
|
|
|
}));
|