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

Esmodule breaks, cljs config extension is recommended but not found #7153

Closed
janat08 opened this issue Jan 21, 2022 Discussed in #7150 · 5 comments · Fixed by #8363
Closed

Esmodule breaks, cljs config extension is recommended but not found #7153

janat08 opened this issue Jan 21, 2022 Discussed in #7150 · 5 comments · Fixed by #8363

Comments

@janat08
Copy link

janat08 commented Jan 21, 2022

Discussed in #7150

Originally posted by janat08 January 21, 2022
I have package.json that says I’m working on esmodule. I got warning that config extension needs to change after reading docs I believe i must also specify new config location when running jit compilation because none of content is detected. Am I right?

@janat08 janat08 changed the title Esmodule breaks Esmodule breaks, cljs config extension is recommended but not found Jan 21, 2022
@molenick
Copy link

I think I'm having the same issue:

npx tailwindcss build -i demo/tailwind-base.css -o demo/style.css

warn - The `content` option in your Tailwind CSS configuration is missing or empty.
warn - Configure your content sources or your generated CSS will be missing styles.
warn - https://tailwindcss.com/docs/content-configuration

I do have a content tag in tailwind.config.cjs, but when I look at demo/style.css it's missing most of what I expect.

@molenick
Copy link

In my project, I was able to get it to build without a config file with this:

npx tailwindcss build -i demo/tailwind-base.css -o demo/style.css --content "./demo/index.html"

It seemed like build wasn't picking up my config with a cjs extension, but specifying the content using --content seems to build as I expect.

@Xeevis
Copy link

Xeevis commented Jan 30, 2022

CLI defaults to ./tailwind.config.js

tailwindcss/src/cli.js

Lines 388 to 392 in ce98735

let configPath = args['--config']
? args['--config']
: ((defaultPath) => (fs.existsSync(defaultPath) ? defaultPath : null))(
path.resolve('./tailwind.config.js')
)

There used to be support for detecting cjs, but for some reason that was removed.

Just pass in --config ./tailwind.config.cjs as command argument.

@janat08
Copy link
Author

janat08 commented Jan 31, 2022 via email

@thecrypticace
Copy link
Contributor

thecrypticace commented May 16, 2022

Thanks for opening the issue! In our insiders build we now attempt to detect that you're in an ES module and will create a config file with a .cjs extension in when we do. This also works for the postcss config file when using the -p flag. You can try out insiders build by installing it via npm: npm install tailwindcss@insiders

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

Successfully merging a pull request may close this issue.

5 participants
@thecrypticace @molenick @Xeevis @janat08 and others