Replies: 1 comment
-
Ah yea, we have a PR out to make this flow more clear in our dev output. Luckily it's an easy fix. When a package import is added as a part of your build (could not be scanned automatically from source) you just need to tell Snowpack about it via your snowpack config's
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I had a weird issue setting up my snowpack react project with styled-components. Somehow I finally managed to make it work, I think it may help other people if I post it here. Or it could even help improve snowpack.
Steps
styled-components
andbabel-plugin-styled-components
as the same as I did in other non-snowpack projects.babel-plugin-styled-components
to the babel config as a plugin.css
prop in react, which is a special prop to be consumed by babel-plugin-styled-components.import "styled-components"
to the App.jsx file./web_modules/
now)import "styled-components"
, no errors.yarn start
, still no errors.If run
yarn build
before step1
, the output code could run well without errors.I guess snowpack resolves dependencies before transpiling code with babel and caches dependency mapping otherwhere so that the above
import "styled-components"
trick worked. 🤔Beta Was this translation helpful? Give feedback.
All reactions