From 6c6d83baeba7289ffeff6c5ec1d90a8d411d2989 Mon Sep 17 00:00:00 2001 From: crupest Date: Mon, 1 Jun 2020 22:48:25 +0800 Subject: Migrate to yarn v2 . --- Timeline/ClientApp/webpack.config.dev.ts | 35 ++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 15 deletions(-) (limited to 'Timeline/ClientApp/webpack.config.dev.ts') diff --git a/Timeline/ClientApp/webpack.config.dev.ts b/Timeline/ClientApp/webpack.config.dev.ts index 869b963b..17c227b3 100644 --- a/Timeline/ClientApp/webpack.config.dev.ts +++ b/Timeline/ClientApp/webpack.config.dev.ts @@ -2,6 +2,7 @@ import path from 'path'; import webpack from 'webpack'; import HtmlWebpackPlugin from 'html-webpack-plugin'; import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin'; +import PnpWebpackPlugin from 'pnp-webpack-plugin'; import { commonRules, htmlCommonConfig } from './webpack.common'; @@ -17,16 +18,20 @@ const config: webpack.Configuration = { exclude: /node_modules/, loader: 'babel-loader', options: { - plugins: ['react-hot-loader/babel'] - } - } - ] + plugins: ['react-hot-loader/babel'], + }, + }, + ], }, resolve: { alias: { - 'react-dom': '@hot-loader/react-dom' + 'react-dom': '@hot-loader/react-dom', }, - extensions: ['*', '.js', '.jsx', '.ts', '.tsx'] + extensions: ['*', '.js', '.jsx', '.ts', '.tsx'], + plugins: [PnpWebpackPlugin], + }, + resolveLoader: { + plugins: [PnpWebpackPlugin.moduleLoader(module)], }, optimization: { runtimeChunk: 'single', @@ -36,16 +41,16 @@ const config: webpack.Configuration = { vendor: { test: /[\\/]node_modules[\\/]/, name: 'vendors', - chunks: 'all' - } - } - } + chunks: 'all', + }, + }, + }, }, output: { path: path.resolve(__dirname, 'dist/'), filename: '[name].[hash].js', chunkFilename: '[name].[hash].js', - publicPath: '/' + publicPath: '/', }, devServer: { contentBase: path.join(__dirname, 'public/'), @@ -53,16 +58,16 @@ const config: webpack.Configuration = { port: 3000, publicPath: 'http://localhost:3000/', historyApiFallback: true, - hotOnly: true + hotOnly: true, }, plugins: [ new HtmlWebpackPlugin({ ...htmlCommonConfig, - devServer: 'http://localhost:3000' + devServer: 'http://localhost:3000', }), new ForkTsCheckerWebpackPlugin(), - new webpack.HotModuleReplacementPlugin() - ] + new webpack.HotModuleReplacementPlugin(), + ], }; export default config; -- cgit v1.2.3