Skip to content

Commit 365b2c5

Browse files
DanHarmanSteveSandersonMS
authored andcommitted
Added babel-loader caching to improve subsequent build times. (aspnet#777)
1 parent efcfc0b commit 365b2c5

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

templates/ReactReduxSpa/webpack.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ module.exports = (env) => {
1010
// Configuration in common to both client-side and server-side bundles
1111
const sharedConfig = () => ({
1212
stats: { modules: false },
13-
resolve: { extensions: [ '.js', '.jsx', '.ts', '.tsx' ] },
13+
resolve: { extensions: ['.js', '.jsx', '.ts', '.tsx'] },
1414
output: {
1515
filename: '[name].js',
1616
publicPath: '/dist/' // Webpack dev middleware, if enabled, handles requests for this URL prefix
1717
},
1818
module: {
1919
rules: [
20-
{ test: /\.tsx?$/, include: /ClientApp/, use: 'babel-loader' },
20+
{ test: /\.tsx?$/, include: /ClientApp/, use: { loader: 'babel-loader', options: { cacheDirectory: true } } },
2121
{ test: /\.tsx?$/, include: /ClientApp/, use: 'awesome-typescript-loader?silent=true' }
2222
]
2323
},
@@ -74,4 +74,4 @@ module.exports = (env) => {
7474
});
7575

7676
return [clientBundleConfig, serverBundleConfig];
77-
};
77+
};

templates/ReactSpa/webpack.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ module.exports = (env) => {
99
return [{
1010
stats: { modules: false },
1111
entry: { 'main': './ClientApp/boot.tsx' },
12-
resolve: { extensions: [ '.js', '.jsx', '.ts', '.tsx' ] },
12+
resolve: { extensions: ['.js', '.jsx', '.ts', '.tsx'] },
1313
output: {
1414
path: path.join(__dirname, bundleOutputDir),
1515
filename: '[name].js',
1616
publicPath: '/dist/'
1717
},
1818
module: {
1919
rules: [
20-
{ test: /\.ts(x?)$/, include: /ClientApp/, use: 'babel-loader' },
20+
{ test: /\.ts(x?)$/, include: /ClientApp/, use: { loader: 'babel-loader', options: { cacheDirectory: true } } },
2121
{ test: /\.tsx?$/, include: /ClientApp/, use: 'awesome-typescript-loader?silent=true' },
2222
{ test: /\.css$/, use: isDevBuild ? ['style-loader', 'css-loader'] : ExtractTextPlugin.extract({ use: 'css-loader' }) },
2323
{ test: /\.(png|jpg|jpeg|gif|svg)$/, use: 'url-loader?limit=25000' }
@@ -41,4 +41,4 @@ module.exports = (env) => {
4141
new ExtractTextPlugin('site.css')
4242
])
4343
}];
44-
};
44+
};

0 commit comments

Comments
 (0)