Add worker bundling configuration
This commit is contained in:
19
worker-pack/tsconfig.json
Normal file
19
worker-pack/tsconfig.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"outDir": "./dist/",
|
||||
"esModuleInterop": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"sourceMap": true,
|
||||
"incremental": true,
|
||||
"noImplicitAny": true
|
||||
},
|
||||
}
|
35
worker-pack/webpack.common.js
Normal file
35
worker-pack/webpack.common.js
Normal file
@ -0,0 +1,35 @@
|
||||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
|
||||
const langNames = fs.readdirSync("engines").filter((name) => {
|
||||
const stats = fs.statSync(`./engines/${name}`);
|
||||
return stats.isDirectory();
|
||||
});
|
||||
|
||||
const entryPoints = {};
|
||||
for (const lang of langNames) {
|
||||
entryPoints[lang] = `./engines/${lang}/engine.ts`;
|
||||
}
|
||||
|
||||
console.log(path.resolve(__dirname, "worker-pack/tsconfig.json"));
|
||||
|
||||
module.exports = {
|
||||
entry: entryPoints,
|
||||
output: {
|
||||
path: path.resolve(__dirname, "../public/workers"),
|
||||
filename: "[name].js",
|
||||
},
|
||||
resolve: { extensions: [".ts"] },
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
loader: "ts-loader",
|
||||
exclude: /node_modules/,
|
||||
options: {
|
||||
configFile: path.resolve(__dirname, "tsconfig.json"),
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
7
worker-pack/webpack.dev.js
Normal file
7
worker-pack/webpack.dev.js
Normal file
@ -0,0 +1,7 @@
|
||||
const { merge } = require("webpack-merge");
|
||||
const common = require("./webpack.common.js");
|
||||
|
||||
module.exports = merge(common, {
|
||||
mode: "development",
|
||||
devtool: "inline-source-map",
|
||||
});
|
6
worker-pack/webpack.prod.js
Normal file
6
worker-pack/webpack.prod.js
Normal file
@ -0,0 +1,6 @@
|
||||
const { merge } = require("webpack-merge");
|
||||
const common = require("./webpack.common.js");
|
||||
|
||||
module.exports = merge(common, {
|
||||
mode: "production",
|
||||
});
|
Reference in New Issue
Block a user