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
Add support for file extension placeholder and function in output.entryFileNames option #3107
Comments
Im not using rollup as general purpose bundler, i just build npm libraries with it. So I’ wondering - what’s the output when u dont use preserveModules and u handle scss etc through rollup? |
If the export default {
input: 'src/FooComponent.tsx',
output: {
file: 'dist/FooComponent.js',
format: 'esm'
},
// other options
} The output from the build would just be
with the SCSS module included within the |
Interesting - I would have thought that SCSS would produce a separate CSS file 🤔 |
It can, depends on how CSS modules are set up. Regardless, the requested feature is still useful for all kinds of workflows beyond the specific example I gave. |
I'm just wondering about the exact workflow here - so the solution can be implemented with all things in mind. In this case, it's somewhat weird for me that SCSS can compile down to regular JS instead of emitting a CSS which in turn would be turned into a "virtual" JS file (if needed). It is what it is though and even might be a good thing, I certainly haven't spent that much time thinking about this. Seems to me that in this case, we should be able to do a "good thing" by default - supporting By doing a good thing here I mean special casing known js~ extensions (js,jsx,ts,tsx) and using current pattern for them, but using |
I'm working on a component library, the setup is like this:
The
As an example, if the var css = {"outer": "Foo__outer_8dF76", "inner": "Foo_inner_kjLU7"};
export default css; |
Ok, I get it now - so the CSS asset gets emitted, just "elsewhere" (a single index.css at root or smth). Thanks for clarifying this. |
You're welcome! Another use-case is when using SVGR which transforms |
I've prepared a PR fixing the original issue here - #3116 |
I want to know, how to setting
|
Closed by: #3658 |
See also
Feature Use Case
If I enable the
preserveModules
option, I get undesired filenames in the build output. For example, I might name a CSS module the same as a component with only the file extension distinguishing the two files:Today, the output from using
preserveModules: true
will give meFeature Proposal
Add a placeholder for the file extension that can be used in the
output.entryFileNames
template option, and add support for specifying a function, so that if I have this configuration:I get this build output:
The text was updated successfully, but these errors were encountered: