Skip to content

Commit 5fb5023

Browse files
authored
chore: generate TS declaration only when needed (#78)
1 parent 58899ae commit 5fb5023

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"compilerOptions": {
33
"allowJs": true,
44
"allowSyntheticDefaultImports": true,
5-
"declaration": true,
65
"esModuleInterop": true,
76
"lib": [
87
"dom",

webpack.config.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ class DtsBundlePlugin {
4242
name: libraryName,
4343
out: '../' + this.outFileName,
4444
outputAsModuleFolder: true,
45-
verbose: true,
4645
})
4746

4847
this.removeSourceDefs(path.resolve(__dirname, './dist'))
@@ -97,6 +96,11 @@ function createConfig(
9796
test: /\.ts$/,
9897
include: [path.resolve(__dirname, './src')],
9998
loader: 'ts-loader',
99+
options: {
100+
compilerOptions: {
101+
declaration: !isInDevMode && (filename === 'leanplum.js'),
102+
},
103+
},
100104
}],
101105
},
102106
output: {
@@ -150,15 +154,9 @@ const swConfig: Partial<webpack.Configuration> = {
150154
if (isInDevMode) {
151155
configuration = createConfig('leanplum.js', lpConfig)
152156
configuration.plugins = [new ForkTsCheckerWebpackPlugin({
153-
compilerOptions: {
154-
declaration: false,
155-
},
156157
silent: false,
157158
})]
158159
configuration.module.rules.find((x) => x.loader === 'ts-loader').options = {
159-
compilerOptions: {
160-
declaration: false,
161-
},
162160
transpileOnly: true,
163161
}
164162
configuration.watch = true

0 commit comments

Comments
 (0)