Skip to content

Commit

Permalink
build: enable multiple tsconfig.json
Browse files Browse the repository at this point in the history
  • Loading branch information
mizdra committed Sep 15, 2018
1 parent be251bb commit 920309e
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 9 deletions.
6 changes: 6 additions & 0 deletions src/app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"lib": ["esnext", "dom"]
}
}
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions src/worker/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"lib": ["esnext", "webworker"]
}
}
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
/* Basic Options */
// "outDir": "./dist",
"target": "es5",
"lib": ["esnext", "dom", "webworker"],
"declaration": false,

/* Module Options */
Expand Down
35 changes: 27 additions & 8 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@ const WORKER_PATH = '/worker.js'
const baseConfig = {
module: {
rules: [
{
test: /\.ts$/,
loader: 'ts-loader',
options: {
appendTsSuffixTo: [/\.vue$/],
},
include: [srcPath],
},
{ test: /\.vue$/, loader: 'vue-loader' },
{
test: /\.css$/,
Expand Down Expand Up @@ -61,6 +53,20 @@ const appConfig = webpackMerge(baseConfig, {
filename: '[name].[hash].js',
},

module: {
rules: [
{
test: /\.ts$/,
loader: 'ts-loader',
options: {
appendTsSuffixTo: [/\.vue$/],
configFile: resolve(appPath, './tsconfig.json'),
},
include: [srcPath],
},
],
},

plugins: [
new HtmlWebpackPlugin({
filename: resolve(distPath, './index.html'),
Expand All @@ -86,6 +92,19 @@ const searchWorkerConfig = webpackMerge(baseConfig, {
path: distPath,
filename: 'worker.js',
},

module: {
rules: [
{
test: /\.ts$/,
loader: 'ts-loader',
options: {
configFile: resolve(workerPath, './tsconfig.json'),
},
include: [srcPath],
},
],
},
})

module.exports = [appConfig, searchWorkerConfig]

0 comments on commit 920309e

Please sign in to comment.