v0.31.0-alpha.1
Pre-releaseOverview
This second pre-release in the v0.31.0 line wraps up the first half of the work done in our previous alpha release of overhauling how Greenwood generates import maps and resolves node_modules dependencies, to better support the entire NodeJS exports map spec as well as play nicer with a variety of package managers (like PNPM) and their various location strategies of where node_modules are installed on disk. We also shipped a couple of bug fixes.
You can peek this repo to see using PNPM in a Greenwood project, with links to other branches with demos for Shoelace, Spectrum Web Components, and the USWDS!
You can find the top-level tracking issue for this release here and if you have any questions, please feel free to reach out in Discord in the Greenwood #general channel.
To test the alpha, either manually bump all the versions in your package.json or you can use your package manager to upgrade each of your Greenwood dependencies to the alpha line (either way, all Greenwood dependencies need to be one the same version).
# npm
$ npm i @greenwood/cli@alpha
# Yarn 1.x (classic)
$ yarn upgrade @greenwood/cli@alpha
# pnpm
$ pnpm i @greenwood/cli@alpha
Changelog
https://github.com/ProjectEvergreen/greenwood/issues?q=label%3Av0.31.0+label%3Aalpha.1
- leverage
import.meta.resolve
to support import maps generation and accurate node_modules resolution when building - Improve PNPM support
- bare CSS
@import
specifiers are not resolving and bundling correctly - better document and clarify Lit SSR plugin usage caveats
- frontmatter imports not working for any format supported by a resource plugin
- ESM only configuration for PostCSS plugin
Breaking Changes
Node Modules
Going forward, the recommended pattern for referencing assets from your node_modules folder (that are not bare module ESM specifiers) will be to start all paths with /node_modules/
. This will ensure Greenwood knows to use import.meta.resolve
to find and lookup your dependency where ever it is installed based on your package managers.
Examples
@import "/node_modules/font-awesome/css/font-awesome.css";
@import "/node_modules/bootstrap/dist/css/bootstrap.css";
<script type="module" src="/node_modules/@shoelace-style/shoelace/dist/shoelace.js"></script>
PostCSS Plugin
Greenwood know supports only needing to have one PostCSS config for your project. So with this release, you can now
- Rename postcss.config.mjs -> postcss.config.js
- Delete postcss.config.cjs
If you're using Storybook, rename your postcss.config.cjs -> .postcssrc.js instead
Known Issues
- Discord link in init scaffolding output is using an expired link
- ESM-only PostCSS config seems to not play well with Storybook - ProjectEvergreen/www.greenwoodjs.dev#145
- The Lit SSR plugin is currently outputting some
console.log
messages, but that will be cleared up as part of