Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix
@shopify/polaris-tokens
treeshaking (#11853)
### WHAT is this pull request doing? This PR adds `"sideEffect": "false"` to the `@shopify/polaris-tokens` `package.json` to enable treeshaking. ### How to 🎩 - Create a new project ```sh mkdir my-project && cd my-project ``` - Initialize a `package.json` and install the test dependencies ``` npm init -y && npm install vite @shopify/[email protected] ``` - Create a basic `vite.config.js` file using library mode ```js import * as vite from 'vite' export default vite.defineConfig({ build: { minify: false, lib: { entry: 'index.js', name: 'MyLib', fileName: 'my-lib', }, }, }) ``` - Create an `index.js` file with a single named import from `@shopify/polaris-tokens` ```js import { themes } from '@shopify/polaris-tokens' console.log('themes:', themes) ``` - Run a production build ```sh npx vite build ``` **Before** ![image](https://github.com/Shopify/polaris/assets/32409546/04cbd4d6-3735-4795-a035-7bbc20611f34) **After** ![image](https://github.com/Shopify/polaris/assets/32409546/006fe31a-73cf-4ad3-9f83-76dfbbf06c1b)
- Loading branch information