You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 29, 2019. It is now read-only.
I have two files in my project: backgrounds.js and bgStyles.less. I want them to be output into js/scripts.js and css/styles.css, so I'm using the following webpack.config:
at the top of /javascript/backgrounds.js. However, this solution has issues:
It is much less conspicuous than having the CSS entry point visible in the top project file.
It doesn't allow the user to establish the a different CSS output filename (for example, having entry point scripts automatically outputs css/scripts.css instead of letting me call it css/styles.css).
It is more complicated for collaborators to find where the CSS file is being brought in from when it's buried in a JavaScript file.
I'd like to submit a request to let the user establish an entry point to CSS files and avoid outputting this unnecessary third .js file.
The text was updated successfully, but these errors were encountered:
webpack natively only understands 'js-ish' files and using a 'css-ish' file as an entry point isn't recommended (imho it should even fail),so you will get a dummy bundle per css entry to 'handle' that. require/import the css inside an entrypoint instead and let extract-text-webpack-plugin emit the CSS file. It removes the CSS from the bundle anyways :)
@michael-ciniawsky I got the same problem when was trying to create a library with optional style file. So when I require/import css inside of main.js and someone tries to import this library somewhere else she or he will get style file because it is imported and in the final built.js we get link to the css. So the only way to create dummy entry with dummy js :(
Do you know how to overcome it?
I faced the same issue of having a style only entry (css/sass/less) generating an extra .js file, and ended up creating a webpack plugin to remove the js file from the compilation.
I have two files in my project:
backgrounds.js
andbgStyles.less
. I want them to be output intojs/scripts.js
andcss/styles.css
, so I'm using the followingwebpack.config
:The configuration file works as expected. The issue is that I get a third output file that is not wanted:
styles.js
simply has the boilerplate Webpack template, and it's useless. I'd like to submit a request to avoid this unnecessary output.I found a workaround in StackOverflow that suggest I use
at the top of
/javascript/backgrounds.js
. However, this solution has issues:scripts
automatically outputscss/scripts.css
instead of letting me call itcss/styles.css
).I'd like to submit a request to let the user establish an entry point to CSS files and avoid outputting this unnecessary third .js file.
The text was updated successfully, but these errors were encountered: