From c73a26123dd777850dae15468fcaafec42cbe546 Mon Sep 17 00:00:00 2001 From: extracold1209 Date: Fri, 27 Mar 2020 13:19:17 +0900 Subject: [PATCH] =?UTF-8?q?[fix]=20ts-loader=20=EA=B0=80=20=EB=B2=88?= =?UTF-8?q?=EB=93=A4=EB=A7=81=EC=8B=9C=20=EB=AA=A8=EB=93=A0=20ts=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=EC=9D=84=20=EA=B2=80=EC=82=AC=ED=95=98?= =?UTF-8?q?=EB=8D=98=20=EC=9D=B4=EC=8A=88=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 각 webpack config 별로 번들에 포함된 파일들만 체크하도록 수정 --- tsconfig.json | 8 ++++---- webpack/webpack.base.config.js | 3 +++ webpack/webpack.electron.config.js | 4 ++-- webpack/webpack.main.config.js | 3 ++- webpack/webpack.preload.config.js | 2 +- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index 636d90b9b..1d574ac59 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -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. */ @@ -73,8 +74,7 @@ // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ "resolveJsonModule": true }, - "include": [ - "./**/*.ts", - "./**/*.tsx" + "exclude": [ + "./node_modules/**/*" ] } diff --git a/webpack/webpack.base.config.js b/webpack/webpack.base.config.js index 79cc5109e..847784bc3 100644 --- a/webpack/webpack.base.config.js +++ b/webpack/webpack.base.config.js @@ -12,6 +12,9 @@ module.exports = { use: [ { loader: 'ts-loader', + options: { + onlyCompileBundledFiles: true, + }, }, ], }, diff --git a/webpack/webpack.electron.config.js b/webpack/webpack.electron.config.js index a4b96d172..fc57181cf 100644 --- a/webpack/webpack.electron.config.js +++ b/webpack/webpack.electron.config.js @@ -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', @@ -15,7 +16,6 @@ module.exports = merge({ filename: 'index.bundle.js', }, externals: [ - '../mainRouter.build', function(requestDirectoryPath, requestModuleName, callback) { // 상대경로로 표기된 모듈의 경우는 번들포함, 외에는 전부 commonjs 모듈 const moduleName = path.basename(requestModuleName); @@ -32,7 +32,7 @@ module.exports = merge({ ], plugins: [ new CleanWebpackPlugin({ - cleanOnceBeforeBuildPatterns: ['*.bundle.js', '*.map'], + cleanOnceBeforeBuildPatterns: ['index.bundle.js', 'index.bundle.js.map'], }), ], }, base); diff --git a/webpack/webpack.main.config.js b/webpack/webpack.main.config.js index 6013ff30b..08160795e 100644 --- a/webpack/webpack.main.config.js +++ b/webpack/webpack.main.config.js @@ -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', @@ -51,7 +52,7 @@ module.exports = merge({ ], plugins: [ new CleanWebpackPlugin({ - cleanOnceBeforeBuildPatterns: ['*.bundle.js', '*.map'], + cleanOnceBeforeBuildPatterns: ['mainRouter.build.js', 'mainRouter.build.js.map'], }), ], }, base); diff --git a/webpack/webpack.preload.config.js b/webpack/webpack.preload.config.js index 658c487b8..aecabd08d 100644 --- a/webpack/webpack.preload.config.js +++ b/webpack/webpack.preload.config.js @@ -25,7 +25,7 @@ module.exports = merge({ ], plugins: [ new CleanWebpackPlugin({ - cleanOnceBeforeBuildPatterns: ['*.bundle.js', '*.map'], + cleanOnceBeforeBuildPatterns: ['preload.bundle.js', 'preload.bundle.js.map'], }), ], }, base);