Skip to content

Commit 9178c23

Browse files
committed
improved local dev
1 parent 6410a72 commit 9178c23

3 files changed

Lines changed: 21 additions & 8 deletions

File tree

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@
4747
"test-coverage": "jest --coverage --collectCoverageFrom=src/**/*.[jt]s",
4848
"test-debug": "node --inspect-brk ./node_modules/jest/bin/jest.js --runInBand --watch",
4949
"watch:js": "tsc --watch --preserveWatchOutput",
50-
"watch:dist": "webpack --watch",
50+
"watch:dist": "webpack --watch --mode development",
5151
"watch": "npm run build-version && npm run build-js && npm run postbuild-js && sh -c 'npm run watch:js & npm run watch:dist & wait'",
52+
"dev": "npm run build-version && sh -c 'npm run watch:js & npm run watch:dist & wait'",
5253
"doc": "typedoc --out ./docs/api/ ./src/ --excludeInternal",
5354
"prepublishOnly": "npm run build && npm run lint && npm test && npm run doc",
5455
"preversion": "npm run lint && npm run typecheck && npm test",

tsconfig.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
"outDir": "dist" /* Redirect output structure to the directory. */,
2424
"rootDir": "src/",
25+
"incremental": true,
26+
"tsBuildInfoFile": "./.tsbuildinfo",
2527

2628
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
2729
// "composite": true, /* Enable project compilation */

webpack.config.mjs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,20 @@ const common = {
5757
fallback: { path: false }
5858
},
5959
devtool: 'source-map',
60+
cache: {
61+
type: 'filesystem'
62+
},
6063
module: {
6164
rules: [
6265
{
6366
test: /\.(mjs|js|ts)$/,
6467
exclude: /(node_modules|bower_components|dist)/,
65-
use: 'babel-loader'
68+
use: {
69+
loader: 'babel-loader',
70+
options: {
71+
cacheDirectory: true
72+
}
73+
}
6674
}, {
6775
test: /\.sparql$/i,
6876
type: 'asset/source'
@@ -165,9 +173,11 @@ const esmUnminified = {
165173
}
166174
}
167175

168-
export default [
169-
minified,
170-
unminified,
171-
esmMinified,
172-
esmUnminified
173-
]
176+
export default (env, argv) => {
177+
const isDev = argv?.mode === 'development'
178+
const devtool = isDev ? 'eval-cheap-module-source-map' : 'source-map'
179+
return [minified, unminified, esmMinified, esmUnminified].map(config => ({
180+
...config,
181+
devtool
182+
}))
183+
}

0 commit comments

Comments
 (0)