Skip to content

Commit

Permalink
feat: add Yarn PnP support
Browse files Browse the repository at this point in the history
  • Loading branch information
merceyz committed Jan 9, 2021
1 parent 8b88e11 commit dd9e94a
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,26 @@ jobs:
WITH_LOG: true
LIGHTHOUSE_CHROMIUM_PATH: 'which google-chrome-stable'
run: npm run test
pnpTest:
name: PnPTest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1

- uses: actions/setup-node@v1
with:
node-version: 12.x

- name: Run PnP test
run: |
git clone https://github.com/preactjs-templates/default.git default
cd default/template
touch yarn.lock
echo $(cat package.json | jq '.name = "pnp-test"') > package.json
yarn set version 2
yarn config set pnpFallbackMode none
yarn config set compressionLevel 0
yarn link -A -p ../..
yarn build
6 changes: 6 additions & 0 deletions packages/cli/lib/lib/webpack/webpack-base-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const ReplacePlugin = require('webpack-plugin-replace');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const createBabelConfig = require('../babel-config');
const loadPostcssConfig = require('postcss-load-config');
const PnpWebpackPlugin = require(`pnp-webpack-plugin`);

function readJson(file) {
try {
Expand Down Expand Up @@ -159,6 +160,11 @@ module.exports = function (env) {
},
},

plugins: [
// TODO: Remove when upgrading to webpack 5
PnpWebpackPlugin,
],

resolveLoader: {
modules: [...nodeModules],
alias: {
Expand Down
1 change: 1 addition & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
"native-url": "0.3.4",
"optimize-css-assets-webpack-plugin": "^5.0.1",
"ora": "^4.0.3",
"pnp-webpack-plugin": "^1.6.4",
"postcss-load-config": "^2.1.0",
"postcss-loader": "^3.0.0",
"progress-bar-webpack-plugin": "^2.1.0",
Expand Down
12 changes: 12 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11187,6 +11187,13 @@ pn@^1.1.0:
resolved "https://registry.yarnpkg.com/pn/-/pn-1.1.0.tgz#e2f4cef0e219f463c179ab37463e4e1ecdccbafb"
integrity sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==

pnp-webpack-plugin@^1.6.4:
version "1.6.4"
resolved "https://registry.yarnpkg.com/pnp-webpack-plugin/-/pnp-webpack-plugin-1.6.4.tgz#c9711ac4dc48a685dabafc86f8b6dd9f8df84149"
integrity sha512-7Wjy+9E3WwLOEL30D+m8TSTF7qJJUJLONBnwQp0518siuMxUQUbgZwssaFX+QKlZkjHZcw/IpZCt/H0srrntSg==
dependencies:
ts-pnp "^1.1.6"

polka@^0.5.2:
version "0.5.2"
resolved "https://registry.yarnpkg.com/polka/-/polka-0.5.2.tgz#588bee0c5806dbc6c64958de3a1251860e9f2e26"
Expand Down Expand Up @@ -14047,6 +14054,11 @@ tryer@^1.0.1:
resolved "https://registry.yarnpkg.com/tryer/-/tryer-1.0.1.tgz#f2c85406800b9b0f74c9f7465b81eaad241252f8"
integrity sha512-c3zayb8/kWWpycWYg87P71E1S1ZL6b6IJxfb5fvsUgsf0S2MVGaDhDXXjDMpdCpfWXqptc+4mXwmiy1ypXqRAA==

ts-pnp@^1.1.6:
version "1.2.0"
resolved "https://registry.yarnpkg.com/ts-pnp/-/ts-pnp-1.2.0.tgz#a500ad084b0798f1c3071af391e65912c86bca92"
integrity sha512-csd+vJOb/gkzvcCHgTGSChYpy5f1/XKNsmvBGO4JXS+z1v2HobugDz4s1IeFXM3wZB44uczs+eazB5Q/ccdhQw==

tslib@^1.9.0:
version "1.13.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.13.0.tgz#c881e13cc7015894ed914862d276436fa9a47043"
Expand Down

0 comments on commit dd9e94a

Please sign in to comment.