Skip to content

Commit

Permalink
fix(scripts): Handle double quotes in require calls
Browse files Browse the repository at this point in the history
While using rollup plugins with vite, the files are first transpiled using esbuild and then passed to
plugin transformation. It looks like esbuild converts single quotes to double quotes in require calls
and that breaks the rollup plugin.
  • Loading branch information
vigneshm committed Jul 18, 2021
1 parent e088b8f commit 429bdd9
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = function angularJsTemplateLoader(options = {}) {
const templateRegex = /require\(['"]([^'"]+\.html)['"]\)/g;

// look for things like require('./template.html')
if (!code.includes("require('") || id.includes('node_modules')) {
if ((!code.includes("require('") && !code.includes(`require("`)) || id.includes('node_modules')) {
return;
}

Expand Down

0 comments on commit 429bdd9

Please sign in to comment.