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

Incorrect asset name when entry point name contains [hash] #560

Closed
kendrickw opened this issue Jan 30, 2019 · 3 comments
Closed

Incorrect asset name when entry point name contains [hash] #560

kendrickw opened this issue Jan 30, 2019 · 3 comments
Assignees

Comments

@kendrickw
Copy link

@kendrickw kendrickw commented Jan 30, 2019

Expected Behavior

Given the rollup config:

// rollup.config.js
export default {
  input: {
     'dash-entry': 'src/entry.js'
  },
  plugins: [
    modularCss(),
    ...
  ],
  output: {
     entryFileNames: '[name].[hash].js',
     assetFileNames: '[name].[hash][extname]'
  },
};

Expect the generated css name to be dash-entry.abababab.css.

Current Behavior

The generated css name is entry.abababab.css (missing dash-).
If I remove the [hash] from entryFileNames, then everything works as expected.
Also, if the input name doesn't have a '-', then the asset name is correctly generated as well.

Your Environment

Executable Version
modular-css 21.1.1
OS Version
macOS Sierra 10.14.2
@tivac tivac self-assigned this Jan 30, 2019
@tivac
Copy link
Owner

@tivac tivac commented Jan 30, 2019

Almost certainly a bug in here:

[ "name", "(?<name>\\w+)" ],

Unfortunately I still don't think there's an easier way to get that info, so I'll have to add a failing test and work backwards.

@kendrickw
Copy link
Author

@kendrickw kendrickw commented Jan 31, 2019

Maybe something like this:

[ "name",     "(?<name>[\\w\\-. ]+)" ],

?

@tivac
Copy link
Owner

@tivac tivac commented Feb 4, 2019

Working on a change to how assets are chunked/named that sidesteps this problem by naming them after the CSS file, not the JS entry file. It's just too painful to try and figure out with the info rollup currently gives me.

Working on that over here, almost done: https://github.com/tivac/modular-css/tree/corrected-chunking

@tivac tivac closed this in e0c5eee Feb 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants