Skip to content

Commit e3b0744

Browse files
committed
chore(styleguide): fix TS support and reformat to be closer to main
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
1 parent a4d5925 commit e3b0744

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

webpack.config.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,6 @@ const sassLoader = {
4040
},
4141
}
4242

43-
webpackRules.RULE_TS = {
44-
test: /\.tsx?$/,
45-
use: [
46-
'babel-loader',
47-
],
48-
}
49-
5043
const cssLoaderOptions = {
5144
modules: {
5245
namedExport: false,
@@ -110,6 +103,17 @@ webpackRules.RULE_JS.exclude = BabelLoaderExcludeNodeModulesExcept([
110103
'tributejs',
111104
])
112105

106+
// Speedup styleguide build
107+
webpackRules.RULE_TS.use = [
108+
'babel-loader',
109+
{
110+
loader: 'ts-loader',
111+
options: {
112+
transpileOnly: true,
113+
},
114+
},
115+
]
116+
113117
webpackRules.RULE_RAW_SVG = {
114118
resourceQuery: /raw/,
115119
type: 'asset/source',
@@ -132,5 +136,10 @@ module.exports = () => {
132136
SCOPE_VERSION,
133137
}))
134138

139+
webpackConfig.resolve.extensionAlias = {
140+
'.js': ['.ts', '.js'],
141+
'.mjs': ['.mts', '.mjs'],
142+
}
143+
135144
return webpackConfig
136145
}

0 commit comments

Comments
 (0)