Skip to content

Commit

Permalink
fix: fix types in webpack config
Browse files Browse the repository at this point in the history
  • Loading branch information
amilajack committed Jan 1, 2022
1 parent fea054d commit eab36f9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
21 changes: 12 additions & 9 deletions .erb/configs/webpack.config.renderer.dev.ts
Expand Up @@ -18,7 +18,7 @@ if (process.env.NODE_ENV === 'production') {

const port = process.env.PORT || 1212;
const manifest = path.resolve(webpackPaths.dllPath, 'renderer.json');
const requiredByDLLConfig = module.parent.filename.includes(
const requiredByDLLConfig = module.parent!.filename.includes(
'webpack.config.renderer.dev.dll'
);

Expand Down Expand Up @@ -97,13 +97,15 @@ const configuration: webpack.Configuration = {
],
},
plugins: [
requiredByDLLConfig
? null
: new webpack.DllReferencePlugin({
context: webpackPaths.dllPath,
manifest: require(manifest),
sourceType: 'var',
}),
...(requiredByDLLConfig
? []
: [
new webpack.DllReferencePlugin({
context: webpackPaths.dllPath,
manifest: require(manifest),
sourceType: 'var',
}),
]),

new webpack.NoEmitOnErrorsPlugin(),

Expand Down Expand Up @@ -149,6 +151,7 @@ const configuration: webpack.Configuration = {
__filename: false,
},

// @ts-ignore
devServer: {
port,
compress: true,
Expand All @@ -167,7 +170,7 @@ const configuration: webpack.Configuration = {
env: process.env,
stdio: 'inherit',
})
.on('close', (code) => process.exit(code))
.on('close', (code: number) => process.exit(code!))
.on('error', (spawnError) => console.error(spawnError));
},
},
Expand Down
1 change: 1 addition & 0 deletions .eslintrc.js
Expand Up @@ -3,6 +3,7 @@ module.exports = {
rules: {
// A temporary hack related to IDE not resolving correct package.json
'import/no-extraneous-dependencies': 'off',
'import/no-unresolved': 'error',
// Since React 17 and typescript 4.1 you can safely disable the rule
'react/react-in-jsx-scope': 'off',
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -6,7 +6,7 @@
"build:main": "cross-env NODE_ENV=production TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.main.prod.ts",
"build:renderer": "cross-env NODE_ENV=production TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.renderer.prod.ts",
"rebuild": "electron-rebuild --parallel --types prod,dev,optional --module-dir release/app",
"lint": "cross-env NODE_ENV=development eslint . --cache --ext .js,.jsx,.ts,.tsx",
"lint": "cross-env NODE_ENV=development eslint . --ext .js,.jsx,.ts,.tsx",
"package": "ts-node ./.erb/scripts/clean.js dist && npm run build && electron-builder build --publish never",
"postinstall": "ts-node .erb/scripts/check-native-dep.js && electron-builder install-app-deps && cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.renderer.dev.dll.ts && opencollective-postinstall",
"start": "ts-node ./.erb/scripts/check-port-in-use.js && npm run start:renderer",
Expand Down

0 comments on commit eab36f9

Please sign in to comment.