1 | exports.name = 'builtin:yarn-pnp'
|
2 |
|
3 | exports.when = api =>
|
4 | api.pkg.data.installConfig && api.pkg.data.installConfig.pnp
|
5 |
|
6 | exports.apply = api => {
|
7 | api.hook('createWebpackChain', config => {
|
8 | const { apply, moduleLoader } = require('@poi/pnp-webpack-plugin')
|
9 |
|
10 | config.resolve.plugin('pnp').use(
|
11 | class PnpWebpackPlugin {
|
12 | apply(...args) {
|
13 | return apply(...args)
|
14 | }
|
15 | }
|
16 | )
|
17 |
|
18 | config.resolveLoader.plugin('pnp').use(
|
19 | class PnpWebpackPlugin {
|
20 | apply(...args) {
|
21 | return moduleLoader(module).apply(...args)
|
22 | }
|
23 | }
|
24 | )
|
25 | })
|
26 | }
|