[Bug] Rollup plugin working locally but not on static build
See original GitHub issueDescribe the bug
We use Storybook with Lit. In our Lit components, we import
SCSS files.
import { html, LitElement } from "lit";
import style from "./quote-block.scss";
@customElement("component-name")
export class ComponentName extends LitElement {
static get styles() {
return [ style ];
}
}
...
To import SCSS and not need to wrap all our imported styles in the unsafeCSS()
function from Lit, we use a plugin in our Vite config - rollup-plugin-postcss-lit
. I’ve also added this plugin to main.js
in Storybook.
Components render as expected with start-storybook
, but the components do not render when using build-storybook
and viewing the resulting static pages. We are met with console errors:
Environment
- Node.js version: [e.g. v14.19.1]
- NPM version: [e.g. 6.14.16]
Additional context
Because the plugin works with a dev server, and after not finding an answer in other repos, I am hoping someone here can provide some insight into why this would be happening, thank you.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
rollup-plugin-multi-entry (virtual) does not work with dev server
When running the dev server, however, it fails to resolve /static/virtual:aleksis-local-full.js and throws a 404 error. My current guess is that ...
Read more >rollup.js
js and webpack, you can use Rollup to compile to UMD or CommonJS format, and then point to that compiled version with the...
Read more >How to Bundle JavaScript With Rollup — Step-by-Step Tutorial
This week, we're going to build our first project using Rollup, which is a build tool for bundling JavaScript (and stylesheets, but we'll...
Read more >Tsdx - rollup-plugin-static-files subfolder - Stack Overflow
I'm building a module using tdsx that implements rollup as a bundler . I have this structure: dist node_modules src templates index.ts.
Read more >@rollup/plugin-commonjs - npm
Rollup with @rollup/plugin-node-resolve resolves modules to their real paths by default. So include and exclude paths should handle real paths ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey @IanVS! Thanks for the quick response. I can clarify a bit on this:
start-storybook
preview shows our expected results; it is only thebuild-storybook
result that doesn’t seem to take the plugin into account.framework: "@storybook/web-components"
or?inline
address the issue.I got a very simple local branch example that gives the same result (sans the console error it seems, but the lack of styles does continue) and I would be happy to submit a PR for it in a few.
Thanks @troyvassalotti! I left a comment in the PR, but for anyone following along here, this is an issue with an incompatibility between the default
include
picomatch of the plugin, vs the filenames that vite generates (which can include a query param). I’m going to close this issue since there’s a workaround, and the main issue is not in this package, but I’m glad you stopped by, and I’m excited to have alit
example in our repo.