|
10 | 10 |
|
11 | 11 | const path = require('path');
|
12 | 12 | const webpack = require('webpack');
|
| 13 | +const PnpWebpackPlugin = require('pnp-webpack-plugin'); |
13 | 14 | const HtmlWebpackPlugin = require('html-webpack-plugin');
|
14 | 15 | const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
|
15 | 16 | const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
|
@@ -149,13 +150,29 @@ module.exports = {
|
149 | 150 | 'react-native': 'react-native-web',
|
150 | 151 | },
|
151 | 152 | plugins: [
|
| 153 | + // Adds support for installing with Plug'n'Play, leading to faster installs and adding |
| 154 | + // guards against forgotten dependencies and such. |
| 155 | + PnpWebpackPlugin, |
152 | 156 | // Prevents users from importing files from outside of src/ (or node_modules/).
|
153 | 157 | // This often causes confusion because we only process files within src/ with babel.
|
154 | 158 | // To fix this, we prevent you from importing files out of src/ -- if you'd like to,
|
155 | 159 | // please link the files into your node_modules/ and let module-resolution kick in.
|
156 | 160 | // Make sure your source files are compiled, as they will not be processed in any way.
|
157 | 161 | new ModuleScopePlugin(paths.appSrc, [paths.appPackageJson]),
|
158 | 162 | ],
|
| 163 | + // Plug'n'Play relies on symlink for its virtual paths (ie peer dependencies), which Webpack |
| 164 | + // always resolve to the absolute path on disk by default. |
| 165 | + symlinks: false, |
| 166 | + }, |
| 167 | + resolveLoader: { |
| 168 | + plugins: [ |
| 169 | + // Also related to Plug'n'Play, but this time it tells Webpack to load its loaders |
| 170 | + // from the current package. |
| 171 | + PnpWebpackPlugin.moduleLoader(module), |
| 172 | + ], |
| 173 | + // Plug'n'Play relies on symlink for its virtual paths (ie peer dependencies), which Webpack |
| 174 | + // always resolve to the absolute path on disk by default. |
| 175 | + symlinks: false, |
159 | 176 | },
|
160 | 177 | module: {
|
161 | 178 | strictExportPresence: true,
|
|
0 commit comments