Skip to content

Commit

Permalink
fix(webpack): change webpack loader output to fix babel warnings (#697)
Browse files Browse the repository at this point in the history
Co-authored-by: Ranieri Benvenuto <ranieri.benvenuto@br.experian.com>
  • Loading branch information
rbenvenuto and Ranieri Benvenuto authored Feb 7, 2021
1 parent 2f8d852 commit e5c602b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module.exports = function(content) {
options.type = commentType[1]
}

let output = `import css from 'styled-jsx/css';\n\nexport default css`
let output = `import css from 'styled-jsx/css';\n\nconst styles = css`

if (options.type === 'global') {
// css.global``
Expand All @@ -46,7 +46,10 @@ module.exports = function(content) {

// Escape backticks and backslashes: “`” ⇒ “\`”, “\” ⇒ “\\”
// (c) https://git.io/fNZzr
output += `\`${content.replace(/[`\\]/g, match => '\\' + match)}\``
output += `\`${content.replace(
/[`\\]/g,
match => '\\' + match
)}\`;\n\nexport default styles;`

this.callback(null, output)
}

0 comments on commit e5c602b

Please sign in to comment.