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

fix(dynamic-import-chunkname): Add proper webpack comment parsing #1163

Merged
merged 1 commit into from
Aug 23, 2018

Conversation

st-sloth
Copy link
Contributor

@st-sloth st-sloth commented Aug 22, 2018

As briefly discussed in #1130, current webpack comment parsing logic (without taking styling into account) is severely flawed, reporting valid comments as errors while also allowing invalid syntax.

This PR adds

  • checking for valid syntax the way webpack itself parses these comments
  • support for multiple keys in these comments, both in a single comment and in several comments (see examples in docs or tests)

Styling requirements have not been relaxed by these changes.

The main topic of #1130 - allowing single quotes in strings in webpack comments - will be implemented on top of these changes once they are merged.

@st-sloth
Copy link
Contributor Author

AppVeyor build failed

Locally tests pass.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.3%) to 97.393% when pulling 8d8c20a on st-sloth:webpack-comment into f7bd328 on benmosher:master.

@ljharb
Copy link
Member

ljharb commented Aug 22, 2018

cc @lencioni @byteme980

@lencioni
Copy link
Contributor

lencioni commented Aug 22, 2018

I investigated why we originally wrote this to enforce double quotes. It turns out that we have an internal babel plugin that only works with double quotes. When we wrote this rule, we assumed that this was webpack's behavior, so we encoded it the rule.

@byteme980
Copy link
Contributor

LGTM, thank you for making these changes 🎉

@ljharb ljharb merged commit df2d526 into import-js:master Aug 23, 2018
Copy link
Member

@benmosher benmosher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants