Skip to content

Commit c2aa3ef

Browse files
committed
Seperate webpack tsconfig from node tsconfig
1 parent e251e63 commit c2aa3ef

File tree

5 files changed

+14
-12
lines changed

5 files changed

+14
-12
lines changed

config/paths.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ const projectRoot = path.join(__dirname, '..');
55
const paths = {
66
dist: path.join(projectRoot, 'dist'),
77
app: path.join(projectRoot, 'src'),
8-
config: path.join(projectRoot, __dirname),
8+
config: __dirname,
99
template: path.join(projectRoot, 'template'),
1010
public: path.join(projectRoot, 'public'),
11+
webpackTSConfig: path.join(__dirname, 'tsconfig.webpack.json'),
1112
staticPath: '/static'
1213
};
1314

config/tsconfig.webpack.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"module": "esnext",
4+
"moduleResolution": "node"
5+
}

config/webpack.dev.config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ const config: Configuration = {
3333
// All files with a '.ts' or '.tsx' extension will be handled by 'awesome-typescript-loader'.
3434
{
3535
test: /\.tsx?$/,
36-
loader: 'awesome-typescript-loader'
36+
loader: 'awesome-typescript-loader',
37+
query: {
38+
configFileName: paths.webpackTSConfig
39+
}
3740
},
3841

3942
// Extract css files into one giant file

src/index.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,7 @@ import * as ReactDOM from 'react-dom';
33

44
import { Hello } from './components/Hello';
55

6-
if (true) {
7-
console.log('hello');
8-
}
9-
106
ReactDOM.render(
117
<Hello compiler="TypeScript" framework="React" />,
128
document.getElementById('root')
139
);
14-
15-
for (let i = 0; i < 5; i++) {
16-
console.log(i);
17-
}

tsconfig.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"exclude": [
3-
"node_modules"
3+
"node_modules",
4+
"./src/**/*"
45
],
56
"compilerOptions": {
67
"outDir": "./dist/",
@@ -15,6 +16,6 @@
1516
]
1617
},
1718
"include": [
18-
"./src/**/*"
19+
"./**/*"
1920
]
2021
}

0 commit comments

Comments
 (0)