Migrate to webpack
This commit is contained in:
parent
07a33c8ee4
commit
4d45e8e576
9 changed files with 1248 additions and 12 deletions
|
@ -12,7 +12,7 @@ module.exports = {
|
|||
parserOptions: {
|
||||
project: [
|
||||
join(__dirname, "tsconfig.app.json"),
|
||||
join(__dirname, "tsconfig.eslint.json"),
|
||||
join(__dirname, "misc.tsconfig.json"),
|
||||
join(__dirname, "src", "tests", "tsconfig.json")
|
||||
]
|
||||
}
|
||||
|
|
|
@ -157,6 +157,9 @@ tsconfig.*.json
|
|||
.drone.yml
|
||||
.woodpecker.yml
|
||||
|
||||
# Build System
|
||||
webpack.config.ts
|
||||
|
||||
# Temporary release-assets
|
||||
.tagName.txt
|
||||
.tagHeading.txt
|
||||
|
|
4
.vscode/tasks.json
vendored
4
.vscode/tasks.json
vendored
|
@ -11,7 +11,7 @@
|
|||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"problemMatcher": "$tsc-watch",
|
||||
"problemMatcher": "$ts-webpack-watch",
|
||||
"isBackground": true,
|
||||
"presentation": {
|
||||
"reveal": "never"
|
||||
|
@ -21,7 +21,7 @@
|
|||
"label": "Rebuild",
|
||||
"type": "npm",
|
||||
"script": "rebuild",
|
||||
"problemMatcher": "$tsc",
|
||||
"problemMatcher": "$ts-webpack",
|
||||
"presentation": {
|
||||
"reveal": "never"
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
"checkJs": true
|
||||
},
|
||||
"include": [
|
||||
"./.eslintrc.cjs"
|
||||
"./.eslintrc.cjs",
|
||||
"./webpack.config.ts"
|
||||
]
|
||||
}
|
1144
package-lock.json
generated
1144
package-lock.json
generated
File diff suppressed because it is too large
Load diff
14
package.json
14
package.json
|
@ -19,10 +19,12 @@
|
|||
"access": "public"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc -b tsconfig.build.json",
|
||||
"webpack": "cross-env NODE_OPTIONS=\"--loader ts-node/esm\" webpack",
|
||||
"build": "npm run webpack --",
|
||||
"compile": "tsc -b tsconfig.build.json",
|
||||
"rebuild": "npm run clean && npm run build",
|
||||
"watch": "npm run build -- --watch",
|
||||
"clean": "npm run build -- --clean && rimraf ./lib",
|
||||
"clean": "npm run compile -- --clean && rimraf ./lib",
|
||||
"lint": "eslint --max-warnings 0 ./src .eslintrc.cjs",
|
||||
"lint-ide": "npm run lint || exit 0",
|
||||
"test": "mocha",
|
||||
|
@ -37,11 +39,17 @@
|
|||
"@manuth/tsconfig": "^3.0.2",
|
||||
"@types/mocha": "^9.1.1",
|
||||
"@types/node": "^18.7.18",
|
||||
"@types/webpack": "^5.28.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^8.23.1",
|
||||
"mocha": "^10.0.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"source-map-support": "^0.5.21",
|
||||
"ts-loader": "^9.4.2",
|
||||
"ts-node": "^10.9.1",
|
||||
"ts-patch": "^2.0.2",
|
||||
"typescript": "^4.8.3"
|
||||
"typescript": "^4.8.3",
|
||||
"webpack": "^5.75.0",
|
||||
"webpack-cli": "^5.0.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": "..",
|
||||
"outDir": "../../lib"
|
||||
"outDir": "../../lib",
|
||||
"composite": true
|
||||
},
|
||||
"include": [
|
||||
"./**/*"
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"path": "./tsconfig.build.json"
|
||||
},
|
||||
{
|
||||
"path": "./tsconfig.eslint.json"
|
||||
"path": "./misc.tsconfig.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
85
webpack.config.ts
Normal file
85
webpack.config.ts
Normal file
|
@ -0,0 +1,85 @@
|
|||
import { resolve } from "path";
|
||||
import { fileURLToPath } from "url";
|
||||
import exports, { Configuration } from "webpack";
|
||||
|
||||
const { WatchIgnorePlugin } = exports;
|
||||
|
||||
let dirname = fileURLToPath(new URL(".", import.meta.url));
|
||||
|
||||
let generator = (env: any, argv: any): Configuration[] =>
|
||||
{
|
||||
return [
|
||||
{
|
||||
target: "web",
|
||||
mode: env.production ? "production" : "development",
|
||||
entry: {
|
||||
main: "./src/index.ts"
|
||||
},
|
||||
output: {
|
||||
filename: "[name].js",
|
||||
path: resolve(dirname, "lib"),
|
||||
devtoolFallbackModuleFilenameTemplate: "../[resource-path]",
|
||||
libraryTarget: "module",
|
||||
chunkFormat: "module",
|
||||
environment: {
|
||||
dynamicImport: true
|
||||
}
|
||||
},
|
||||
devtool: "source-map",
|
||||
resolve: {
|
||||
extensions: [
|
||||
".ts",
|
||||
".js"
|
||||
],
|
||||
extensionAlias: {
|
||||
".js": [
|
||||
".js",
|
||||
".ts"
|
||||
],
|
||||
".mjs": [
|
||||
".mjs",
|
||||
".mts"
|
||||
],
|
||||
".cjs": [
|
||||
".cjs",
|
||||
".cts"
|
||||
]
|
||||
}
|
||||
},
|
||||
plugins: [
|
||||
new WatchIgnorePlugin(
|
||||
{
|
||||
paths: [
|
||||
/\.d\.ts$/
|
||||
]
|
||||
})
|
||||
],
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.([cm]?ts|tsx)$/,
|
||||
exclude: /node_modules/,
|
||||
use: [
|
||||
{
|
||||
loader: "ts-loader",
|
||||
options: {
|
||||
configFile: resolve(dirname, "tsconfig.build.json"),
|
||||
projectReferences: true,
|
||||
compilerOptions: {
|
||||
outDir: resolve(dirname, "lib", "temp")
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
experiments: {
|
||||
outputModule: true
|
||||
}
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default generator;
|
Loading…
Reference in a new issue