-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use with webpack? #7
Comments
I'm afraid I am not at all proficient in webpack. I would be relegated to using google search, which I'm sure you have already done. To get you going (as a temporary work-around), you could manually extract the results of I would encourage you to continue to search for a permanent solution. Please reply to this issue with your findings, so others may benefit. In addition, I can update the docs with your findings. Sorry I couldn't be of more assistance. |
Any more knowledge on this now for I can't get it done in Vite (with Vue3)? If so it would be nice if you could make a GitHub demo setup branche for Vite and/or Webpack. It's unfortunate the module and setup process as you describe only works for Svelte with Rollup. I am really in love with your project but am stuck! Please... |
Hello @violacase, As I mentioned previously, I'm a bit of a novice on bundler options and configurations. As you know, this issue is related to the build process (i.e. tailwind configuration), and not the TwThemes run-time itself. Because we are attempting to invoke, what is in essence some app-level code in the configuration of tailwind, we are experiencing issues related to ES Modules (i.e. import/export) in the build process. I did a quick google search on "tailwindcss configuration with ES Modules", and while I found a couple of issues, they do not appear to be very active.
With that said, I'm thinking about documenting an alternate approach to the tailwind configuration setup that will work in all environments. You can actually use this approach now, so please don't let this issue be a sticking point that prevents you from using tw-themes :-) My thought is to promote an alternative configuration process that bypasses the direct invocation of If you think about it, the color theme structure in your project very rarely changes. You can simply extract the content result of This could even be semi-automated through a unit test, that performed the extraction (invoking This in essence is a modified rendition of the "temporary work-around" that I mentioned above (on 11/12/2021). I am currently a bit over-taxed, but I would encourage you to give this a try. It should be extremely simple to accomplish. Report back to me, and I will consider updating the formal documentation with this alternate approach. </Kevin> |
Hi Kevin, NB: I noticed one hour ago that codesandbox itself has problems with Vite and ALSO with Tailwind environment. Gr..... If you'll find the time to solve all this issues I'm extra happy. If not let it be. Than I rest also happy. Thanks again. |
The dirt simplest thing you can do is to merely inject some temporary code that emits the configuration to your console log, and then copy/paste that configuration into your In the Getting Started section of the docs:
This simple solution does not include the "extra credit" exercise of semi-automating the process through a unit test, but it will get you going. You will need to re-execute this procedure anytime your context color names change (i.e. that is the only thing that will change the output of Hope this helps. </Kevin> |
My tailwind.config.js looks like this: ` ], corePlugins: { plugins: [ ], |
Sorry, I was mixing in the ES Module syntax, which is no longer applicable with this new approach. I have edited my previous reply appropriately (see Step 4). The |
Another problem: I DO find it physically in the node tree however. |
This is a named import, so you need squiggles around the name: import {initTwThemes} from 'tw-themes'; |
Same issue... I'm sure it's not the project's set up for all other imports work. |
hmmm ... My library bundling process is using a pure babel solution (see the "lib:build" npm script in package.json). In looking at the bundles The odd thing is I do not have an issue importing it in my Svelte project, and I have not had any complaints from other users. Is this error occurring at runtime of of your Vue app or in the build process of Vite? I'm really unsure how to proceed on this. I'm wondering if there is some Vite configuration that may solve the problem? |
No, not in run time. The built in checker of vscode editor reports this. I think you have to refactor your files thus they become pure ES modules. |
Hi there!
I can't seem to find a way around the ES Modules issue when using webpack. (Actually, I am using Laravel Mix which uses webpack.)
"import" statements cannot be used in webpack configuration files. Any hint as to how I can set this up is most appreciated.
Thank you!
The text was updated successfully, but these errors were encountered: