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 encoding issues in the loader #243

Merged
merged 2 commits into from
Nov 19, 2019
Merged

Conversation

aalemayhu
Copy link
Member

The issues I have experienced were related to encodeURIComponent
function not encoding ! and '. Moving to cache the style bodies in
a map resolves that since we no longer need to encode/decode.

This also removes the wall of text generated from the Webpack hack used
to load the style.

I added a comment in define to trigger the error during yarn build.

Purposed-by: Sindre Aarsaether sindre@identu.no
Closes: #240 (Build issues with font-properties in SFC)
Closes: #239 (Module not found: Error: Can't resolve 'important[...] in SFC)

somebee
somebee previously approved these changes Nov 14, 2019
loader.js Show resolved Hide resolved
loader.js Outdated
let pars = '?type=style';

if(style.scoped){
pars = pars + "&id=" + opts.id;
}
const query = `${src}!=!imba/loader?type=style&index=${i}&body=${body}!${remReq}${pars}`
cachedStyleBodies[styleBlockId] = style.content;
const query = `${src}!=!imba/loader?type=style&index=${i}&body=${styleBlockId}!${remReq}${pars}`
Copy link
Member Author

@aalemayhu aalemayhu Nov 14, 2019

Choose a reason for hiding this comment

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

use .set(...).

loader.js Show resolved Hide resolved
Copy link
Member Author

@aalemayhu aalemayhu left a comment

Choose a reason for hiding this comment

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

Add follow up notes from offline review.

Copy link
Member

@somebee somebee left a comment

Choose a reason for hiding this comment

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

Need to include the index in cachedStyleBodies key.

The issues I have experienced were related to `encodeURIComponent`
function not encoding `!` and `'`. Moving to caching the style bodies in
a map resolves that since we no longer need to encode / decode.

This also removes the wall of text generated from the webpack hack used
to load the style.

I added a comment in define to trigger the error during `yarn build`.

Closes: #240 (Build issues with font-properties in SFC)
Closes: #239 (Module not found: Error: Can't resolve 'important[...] in SFC)
@aalemayhu aalemayhu merged commit 77225ef into master Nov 19, 2019
@aalemayhu aalemayhu deleted the fix-encoding-issue-loader branch November 19, 2019 06:36
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

Successfully merging this pull request may close these issues.

Build issues with font-properties in SFC Module not found: Error: Can't resolve 'important[...] in SFC
2 participants