preactjs / preact-cli

😺 Your next Preact PWA starts in 30 seconds.

Home Page:https://cli-demo-next.preactjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OptimizeCssAssetsPlugin causes build to crash in Yarn PnP mode

wojtekmaj opened this issue · comments

What is the current behaviour?

When running yarn preact build in PnP mode, the following error appears:

(node:92484) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
✖ ERROR TypeError: [ERR_IMPORT_ASSERTION_TYPE_MISSING]: Module "file:///Users/wmaj/Projekty/default-app/package.json" needs an import assertion of type "json"
    at load$1 (file:///Users/wmaj/Projekty/default-app/.pnp.loader.mjs:1458:17)
    at nextLoad (node:internal/modules/esm/hooks:832:28)
    at Hooks.load (node:internal/modules/esm/hooks:415:26)
    at MessagePort.handleMessage (node:internal/modules/esm/worker:168:24)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:807:20)
    at exports.emitMessage (node:internal/per_context/messageport:23:28)

This seems to be caused by OptimizeCssAssetsPlugin, which, when commented out from .yarn/unplugged/preact-cli-virtual-706939ec33/node_modules/preact-cli/src/lib/webpack/webpack-client-config.js, lets the build continue flawlessly.

Steps to Reproduce
Steps to reproduce the behavior:

Using Yarn v2/v3/v4:

yarn dlx preact-cli create typescript ts-app --yarn
cd ts-app
yarn build

What is the expected behaviour?

Build to run 🤷

Please mention any other relevant information

Environment Info:
System:
OS: macOS 14.0
CPU: (8) arm64 Apple M2
Binaries:
Node: 20.7.0 - /private/var/folders/3y/swkjq1x101b76mzjgt4pm2d80000gp/T/xfs-119087d3/node
Yarn: 3.6.1 - /private/var/folders/3y/swkjq1x101b76mzjgt4pm2d80000gp/T/xfs-119087d3/yarn
npm: 10.1.0 - /opt/homebrew/bin/npm
Browsers:
Edge: 117.0.2045.55
Safari: 17.0

Yarn PnP is unsupported, sorry.

You could try out v4, we dropped OptimizeCssAssetsPlugin there