Skip to content

Commit

Permalink
Make builds of TS-declarations more deterministic
Browse files Browse the repository at this point in the history
The cause for this was unknown, and was fixed by using "fork-ts-checker-webpack-plugin" instead of
"ts-loader".

Co-authored-by: Iku-turso <mikko.aspiala@gmail.com>

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
  • Loading branch information
Iku-turso authored and jansav committed Mar 1, 2023
1 parent ec81af4 commit 1944c1b
Show file tree
Hide file tree
Showing 9 changed files with 494 additions and 193 deletions.
18 changes: 5 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/infrastructure/webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"dependencies": {
"@types/webpack-env": "^1.18.0",
"css-loader": "^6.7.2",
"fork-ts-checker-webpack-plugin": "^7.3.0",
"mini-css-extract-plugin": "^2.7.0",
"sass-loader": "^13.2.0",
"style-loader": "^3.3.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`get-multi-export-config given maximal package.json, when creating configuration works 1`] = `
Array [
Object {
"entry": Object {
"index": "./index.ts",
},
"externals": Array [
[Function],
[Function],
],
"externalsPresets": Object {
"node": true,
},
"mode": "production",
"module": Object {
"rules": Array [
Object {
"loader": "ts-loader",
"test": /\\\\\\.ts\\(x\\)\\?\\$/,
},
],
},
"name": "./index.ts",
"node": Object {
"__dirname": true,
"__filename": true,
},
"output": Object {
"filename": [Function],
"libraryTarget": "commonjs2",
"path": "/some-working-directory/dist",
},
"performance": Object {
"hints": "error",
"maxEntrypointSize": 100000,
},
"plugins": Array [
ForkTsCheckerWebpackPlugin {
"options": Object {
"typescript": Object {
"configOverwrite": Object {
"compilerOptions": Object {
"declaration": true,
"declarationDir": "/some-working-directory/dist",
},
"include": Array [
"./index.ts",
],
},
"mode": "write-dts",
},
},
},
],
"resolve": Object {
"extensions": Array [
".ts",
".tsx",
],
},
"target": "node",
},
Object {
"entry": Object {
"index": "./some-entrypoint/index.ts",
},
"externals": Array [
[Function],
[Function],
],
"externalsPresets": Object {
"node": true,
},
"mode": "production",
"module": Object {
"rules": Array [
Object {
"loader": "ts-loader",
"test": /\\\\\\.ts\\(x\\)\\?\\$/,
},
],
},
"name": "./some-entrypoint/index.ts",
"node": Object {
"__dirname": true,
"__filename": true,
},
"output": Object {
"filename": [Function],
"libraryTarget": "commonjs2",
"path": "/some-working-directory/dist/some-entrypoint",
},
"performance": Object {
"hints": "error",
"maxEntrypointSize": 100000,
},
"plugins": Array [
ForkTsCheckerWebpackPlugin {
"options": Object {
"typescript": Object {
"configOverwrite": Object {
"compilerOptions": Object {
"declaration": true,
"declarationDir": "/some-working-directory/dist/some-entrypoint",
},
"include": Array [
"./some-entrypoint/index.ts",
],
},
"mode": "write-dts",
},
},
},
],
"resolve": Object {
"extensions": Array [
".ts",
".tsx",
],
},
"target": "node",
},
Object {
"entry": Object {
"index": "./some-other-entrypoint/index.ts",
},
"externals": Array [
[Function],
[Function],
],
"externalsPresets": Object {
"node": true,
},
"mode": "production",
"module": Object {
"rules": Array [
Object {
"loader": "ts-loader",
"test": /\\\\\\.ts\\(x\\)\\?\\$/,
},
Object {
"test": /\\\\\\.s\\?css\\$/,
"use": Array [
Object {
"some": "miniCssExtractPluginLoader",
},
Object {
"loader": "css-loader",
"options": Object {
"modules": Object {
"auto": /\\\\\\.module\\\\\\./i,
"localIdentName": "[name]__[local]--[hash:base64:5]",
"mode": "local",
},
"sourceMap": false,
},
},
Object {
"loader": "sass-loader",
"options": Object {
"sourceMap": false,
},
},
],
},
],
},
"name": "./some-other-entrypoint/index.ts",
"node": Object {
"__dirname": true,
"__filename": true,
},
"output": Object {
"filename": [Function],
"libraryTarget": "commonjs2",
"path": "/some-working-directory/dist/some-other-entrypoint",
},
"performance": Object {
"hints": "error",
"maxEntrypointSize": 100000,
},
"plugins": Array [
ForkTsCheckerWebpackPlugin {
"options": Object {
"typescript": Object {
"configOverwrite": Object {
"compilerOptions": Object {
"declaration": true,
"declarationDir": "/some-working-directory/dist/some-other-entrypoint",
},
"include": Array [
"./some-other-entrypoint/index.ts",
],
},
"mode": "write-dts",
},
},
},
MiniCssExtractPlugin {
"_sortedModulesCache": WeakMap {},
"options": Object {
"chunkFilename": "[name].css",
"experimentalUseImportModule": undefined,
"filename": "[name].css",
"ignoreOrder": false,
"runtime": true,
},
"runtimeOptions": Object {
"attributes": undefined,
"insert": undefined,
"linkType": "text/css",
},
},
],
"resolve": Object {
"extensions": Array [
".ts",
".tsx",
],
},
"target": "node",
},
]
`;

0 comments on commit 1944c1b

Please sign in to comment.