Skip to content
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

Inconsistent with Typescript #29

Open
JaffParker opened this issue May 26, 2019 · 1 comment
Open

Inconsistent with Typescript #29

JaffParker opened this issue May 26, 2019 · 1 comment

Comments

@JaffParker
Copy link

I use Create React App with Typescript, so to make the macro work in development, I have to use ES2015 export syntax in tailwind.ts:

export default {
  // config goes here
}

This, however, doesn't work in the build process. For some reason during build, the macro expects specifically the CommonJS export syntax. For now I just change it manually, but I think it's obvious why it's not ideal.

@rafamel
Copy link

rafamel commented Jun 3, 2019

Another issue with the CRA setup is that we're forced to place the config file within src, hence tempted to use variables and importing stuff that will only be defined on the browser. Since this is a compile-time config, it should be separated from runtime.

Requiring files on babel-plugin-macros.config.js is perfectly fine so I'd propose instead of -or in addition to- being able to define the file it lives at, we can provide the config object itself. This would solve both issues w/ CRA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants