question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issues pre-bundling twin components with Rollup and importing them

See original GitHub issue

Hey,

This may be a dumb question.

If i publish a package to NPM … say button that i use this macro within and then publish. If i then import this package with the button would this still work?

for example…

import tw from "twin.macro";

const Button = () => <button tw="w-32 m-10 p-5 block opacity-50 hover:opacity-100">ddd</button>

export default Button;

nextjs site

import Button from "package";

const page = () => <Button />

export default page;

should that work or am i missing the point the macros in that it is only compile time… I use rollup for button example

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:18 (8 by maintainers)

github_iconTop GitHub Comments

7reactions
ben-rogersoncommented, Jun 24, 2020

Valid point, I’ll see what I can put together on the topic.

2reactions
ben-rogersoncommented, Jan 12, 2021

Check out the Twin component library monorepo for a pretty sweet component library setup 🎉

I’m closing up this issue now but feel free to reopen if there are any further issues.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pre-bundled dependencies doesn't dedupe imports ... - GitHub
This is the problem, Component.vue will import bar from it's relative './shared.js file, but .vite/foo-library.js has its own bar reference!
Read more >
Rollup & React- How to separate component bundles?
Currently I am using typescript and rollup, and I am able to bundle a single index.js and I am able to import those...
Read more >
How to Bundle JavaScript With Rollup — Step-by-Step Tutorial
Inside, we import the Babel plugin, then add it to a new configuration property called plugins , which will hold an array of...
Read more >
Comparing the New Generation of Build Tools - CSS-Tricks
How are these different from existing tools? Whether we use webpack, Rollup, or Parcel for a development server, the tool bundles our entire ......
Read more >
Code-splitting for libraries—bundling for npm with Rollup 1.0
This can lead to nasty issues, though, if different parts of the users's code import our library in different ways. Imagine one module...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found