-
Notifications
You must be signed in to change notification settings - Fork 174
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
Conversation
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}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use .set(...)
.
There was a problem hiding this 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.
df82330
to
ce60c77
Compare
There was a problem hiding this 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)
ce60c77
to
9f9601b
Compare
The issues I have experienced were related to
encodeURIComponent
function not encoding
!
and'
. Moving to cache the style bodies ina 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)