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

Multiple packs same name different extension #2088

Closed
ionutzp opened this issue May 8, 2019 · 4 comments
Closed

Multiple packs same name different extension #2088

ionutzp opened this issue May 8, 2019 · 4 comments

Comments

@ionutzp
Copy link

ionutzp commented May 8, 2019

If one adds multiple packs with the same name but a different extension for example application.scss and application.js only the last one will make it to the webpack entry path configuration. This is done here

Expected behaviour would be that both paths are kept in the webpack entry paths

@default-anton
Copy link

You literally saved me hours of struggle 👍 🎉

@rossta
Copy link
Member

rossta commented Nov 5, 2019

I'm not sure this is a Webpacker bug. I get that the behavior is not what's expected—it is most certainly different that Sprockets. I believe the underlying dissonance is that Webpack entry points (which we're calling "packs" in Webpacker) are typically configured as JS object key => value pairs, i.e., the property application can only be used once in an object. https://webpack.js.org/concepts/entry-points/

It might be weird to key the entry points including the extension—this would yield output names like application.js.js, application.css.css. Perhaps another fix could be for Webpacker to detect duplicate names and exit with a helpful error message.

For those finding this issue and wondering what to do, I'd recommend the "Webpack way" here would be to use a single entry point, your application.js pack, and import '../application.css' from there.

@rossta
Copy link
Member

rossta commented Jan 13, 2021

Fixed by #2476

@rossta rossta closed this as completed Jan 13, 2021
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

4 participants