From 365b2c50cb3daed02bbc6a79014d19b66c98f573 Mon Sep 17 00:00:00 2001 From: Dan Harman Date: Wed, 22 Mar 2017 10:28:26 +0000 Subject: [PATCH] Added babel-loader caching to improve subsequent build times. (#777) --- templates/ReactReduxSpa/webpack.config.js | 6 +++--- templates/ReactSpa/webpack.config.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/templates/ReactReduxSpa/webpack.config.js b/templates/ReactReduxSpa/webpack.config.js index 4a09f5a..ce9ece3 100644 --- a/templates/ReactReduxSpa/webpack.config.js +++ b/templates/ReactReduxSpa/webpack.config.js @@ -10,14 +10,14 @@ module.exports = (env) => { // Configuration in common to both client-side and server-side bundles const sharedConfig = () => ({ stats: { modules: false }, - resolve: { extensions: [ '.js', '.jsx', '.ts', '.tsx' ] }, + resolve: { extensions: ['.js', '.jsx', '.ts', '.tsx'] }, output: { filename: '[name].js', publicPath: '/dist/' // Webpack dev middleware, if enabled, handles requests for this URL prefix }, module: { rules: [ - { test: /\.tsx?$/, include: /ClientApp/, use: 'babel-loader' }, + { test: /\.tsx?$/, include: /ClientApp/, use: { loader: 'babel-loader', options: { cacheDirectory: true } } }, { test: /\.tsx?$/, include: /ClientApp/, use: 'awesome-typescript-loader?silent=true' } ] }, @@ -74,4 +74,4 @@ module.exports = (env) => { }); return [clientBundleConfig, serverBundleConfig]; -}; +}; \ No newline at end of file diff --git a/templates/ReactSpa/webpack.config.js b/templates/ReactSpa/webpack.config.js index dc58909..fa76d10 100644 --- a/templates/ReactSpa/webpack.config.js +++ b/templates/ReactSpa/webpack.config.js @@ -9,7 +9,7 @@ module.exports = (env) => { return [{ stats: { modules: false }, entry: { 'main': './ClientApp/boot.tsx' }, - resolve: { extensions: [ '.js', '.jsx', '.ts', '.tsx' ] }, + resolve: { extensions: ['.js', '.jsx', '.ts', '.tsx'] }, output: { path: path.join(__dirname, bundleOutputDir), filename: '[name].js', @@ -17,7 +17,7 @@ module.exports = (env) => { }, module: { rules: [ - { test: /\.ts(x?)$/, include: /ClientApp/, use: 'babel-loader' }, + { test: /\.ts(x?)$/, include: /ClientApp/, use: { loader: 'babel-loader', options: { cacheDirectory: true } } }, { test: /\.tsx?$/, include: /ClientApp/, use: 'awesome-typescript-loader?silent=true' }, { test: /\.css$/, use: isDevBuild ? ['style-loader', 'css-loader'] : ExtractTextPlugin.extract({ use: 'css-loader' }) }, { test: /\.(png|jpg|jpeg|gif|svg)$/, use: 'url-loader?limit=25000' } @@ -41,4 +41,4 @@ module.exports = (env) => { new ExtractTextPlugin('site.css') ]) }]; -}; +}; \ No newline at end of file