Skip to content

Commit

Permalink
[fix] ts-loader 가 번들링시 모든 ts 파일을 검사하던 이슈 수정
Browse files Browse the repository at this point in the history
- 각 webpack config 별로 번들에 포함된 파일들만 체크하도록 수정
  • Loading branch information
extracold1209 authored and entrydev committed Mar 27, 2020
1 parent 9c3f065 commit c73a261
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
8 changes: 4 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */

/* Module Resolution Options */
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
"moduleResolution": "node",
/* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
Expand Down Expand Up @@ -73,8 +74,7 @@
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
"resolveJsonModule": true
},
"include": [
"./**/*.ts",
"./**/*.tsx"
"exclude": [
"./node_modules/**/*"
]
}
3 changes: 3 additions & 0 deletions webpack/webpack.base.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ module.exports = {
use: [
{
loader: 'ts-loader',
options: {
onlyCompileBundledFiles: true,
},
},
],
},
Expand Down
4 changes: 2 additions & 2 deletions webpack/webpack.electron.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const base = require('./webpack.base.config');

module.exports = merge({
dependencies: ['mainRouter'],
target: 'electron-main',
entry: path.join(__dirname, '..', 'app', 'src', 'main', 'electron', 'index.ts'),
devtool: 'cheap-module-source-map',
Expand All @@ -15,7 +16,6 @@ module.exports = merge({
filename: 'index.bundle.js',
},
externals: [
'../mainRouter.build',
function(requestDirectoryPath, requestModuleName, callback) {
// 상대경로로 표기된 모듈의 경우는 번들포함, 외에는 전부 commonjs 모듈
const moduleName = path.basename(requestModuleName);
Expand All @@ -32,7 +32,7 @@ module.exports = merge({
],
plugins: [
new CleanWebpackPlugin({
cleanOnceBeforeBuildPatterns: ['*.bundle.js', '*.map'],
cleanOnceBeforeBuildPatterns: ['index.bundle.js', 'index.bundle.js.map'],
}),
],
}, base);
3 changes: 2 additions & 1 deletion webpack/webpack.main.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const commonjsModules = [
];

module.exports = merge({
name: 'mainRouter',
target: 'electron-main',
entry: path.join(mainDirectoryPath, 'mainRouter.ts'),
devtool: 'cheap-module-source-map',
Expand Down Expand Up @@ -51,7 +52,7 @@ module.exports = merge({
],
plugins: [
new CleanWebpackPlugin({
cleanOnceBeforeBuildPatterns: ['*.bundle.js', '*.map'],
cleanOnceBeforeBuildPatterns: ['mainRouter.build.js', 'mainRouter.build.js.map'],
}),
],
}, base);
2 changes: 1 addition & 1 deletion webpack/webpack.preload.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = merge({
],
plugins: [
new CleanWebpackPlugin({
cleanOnceBeforeBuildPatterns: ['*.bundle.js', '*.map'],
cleanOnceBeforeBuildPatterns: ['preload.bundle.js', 'preload.bundle.js.map'],
}),
],
}, base);

0 comments on commit c73a261

Please sign in to comment.