Component built with --target lib does not persist styles when imported
See original GitHub issueVersion
3.0.0-beta.15
Reproduction link
https://github.com/MartinPeverelli/reproduction-app
Steps to reproduce
git clone git@github.com:MartinPeverelli/reproduction-app.git
npm run install
npm run serve
What is expected?
Title on screen should be red, because imported component ReproductionModuleTranspiled has scoped styles defining its text to be red.
What is actually happening?
Title on screen is black, styles are not being applied from imported module
Component ReproductionModuleTranspiled is here: https://github.com/MartinPeverelli/reproduction-module-transpiled
Was built using vue-cli-service build --target lib src/main.js
and has .env.production
with VUE_CLI_CSS_SHADOW_MODE = true
The generated dist files do indeed contain the scoped css, but it is not being applied when the component is imported on the main app.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
vue-cli-service build --target lib does not respect @ paths
The problem is that when building the project using yarn buildLib , vue-cli-service build does not resolve the @ in import paths and...
Read more >Troubleshooting Guide - React Flow
This guide contains warnings and errors that can occur when using React Flow. We are also adding common questions and pitfalls that we...
Read more >Styling in React: 5 ways to style React apps - LogRocket Blog
Sharing styles across many React components. The style objects and the components do not have to be in the same file. We can...
Read more >Angular workspace configuration
In Sass you can make use of the includePaths feature for both component and global styles. This allows you to add extra base...
Read more >Parcel
The zero configuration build tool for the web. ... All of this is completely automatic and does not require any work by plugin...
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
@yyx990803 just found this in the docs (which I see are under heavy update)
dist/myLib.css: Extracted CSS file (can be forced into inlined by setting css: { extract: false } in vue.config.js)
That appears to produce the desired effect. Thanks!
Hey, your solution worked for me but when using it with nuxt ssr, I get the following error:
document is not defined
And this snippet of code is supposedly the reason:
in the common.js file