Skip to content
This repository has been archived by the owner on Aug 20, 2018. It is now read-only.

refactor: use jsesc to escape special characters #62

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bmeurer
Copy link

@bmeurer bmeurer commented Sep 28, 2017

Similar to webpack-contrib/raw-loader#36 we can use
jsesc here to deal with special characters in general.

Similar to webpack-contrib/raw-loader#36 we can
use jsesc here to deal with special characters in general.
Copy link
Member

@michael-ciniawsky michael-ciniawsky left a comment

Choose a reason for hiding this comment

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

Do we really need it ? Why?

.replace(/\u2028/g, '\\u2028')
.replace(/\u2029/g, '\\u2029');
value = JSON.stringify(value);
value = jsesc(value);
Copy link
Member

Choose a reason for hiding this comment

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

Is jsesc(value, { json: true }) a thing/require/needed here? (I'm not familiar with this module)

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Given webpack handles json at this point, why are we updating this here?

Copy link
Member

Choose a reason for hiding this comment

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

'Native JSON Support' turned out to be mainly a push(jsonLoader) for .json if missing https://github.com/webpack/webpack/pull/3374/files#diff-6cff30a1f2b17edb1b17434da5a7d140

Copy link
Member

Choose a reason for hiding this comment

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

lol, of course

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants