-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompile-core.js
32 lines (27 loc) · 913 Bytes
/
compile-core.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const path = require("path");
const webpack = require("webpack");
const { parentPort } = require("worker_threads");
const { SourceMapDevToolPlugin } = require("webpack");
const { createConfigBundle } = require("./node_modules/@l2js/core/configs/create-config");
const { realpathSync } = require("fs");
const config = createConfigBundle({
name: "index.local",
mode: "development",
devtool: "source-map",
minimize: false,
dirOutput: realpathSync(path.resolve(__dirname, "l2js-core")),
library: true
});
config.plugins.unshift(new SourceMapDevToolPlugin({
filename: "[name].js.map[query]",
sourceRoot: path.resolve(__dirname, "./l2js-core/") // yarn link will create a symbolic link
}));
const compiler = webpack(config);
compiler.run(function (err, result) {
if (err)
throw err;
compiler.close(function (err) {
if (err)
throw err;
});
});