c){if(47===r.charCodeAt(a+u))return r.slice(a+u+1);if(0===u)return r.slice(a+u)}else s>c&&(47===e.charCodeAt(i+u)?l=u:0===u&&(l=0));break}var h=e.charCodeAt(i+u);if(h!==r.charCodeAt(a+u))break;47===h&&(l=u)}var f="";for(u=i+l+1;u<=o;++u)u!==o&&47!==e.charCodeAt(u)||(0===f.length?f+="..":f+="/..");return f.length>0?f+r.slice(a+l):(a+=l,47===r.charCodeAt(a)&&++a,r.slice(a))},_makeLong:function(e){return e},dirname:function(e){if(t(e),0===e.length)return".";for(var r=e.charCodeAt(0),n=47===r,i=-1,o=!0,s=e.length-1;s>=1;--s)if(47===(r=e.charCodeAt(s))){if(!o){i=s;break}}else o=!1;return-1===i?n?"/":".":n&&1===i?"//":e.slice(0,i)},basename:function(e,r){if(void 0!==r&&"string"!=typeof r)throw new TypeError('"ext" argument must be a string');t(e);var n,i=0,o=-1,s=!0;if(void 0!==r&&r.length>0&&r.length<=e.length){if(r.length===e.length&&r===e)return"";var a=r.length-1,p=-1;for(n=e.length-1;n>=0;--n){var c=e.charCodeAt(n);if(47===c){if(!s){i=n+1;break}}else-1===p&&(s=!1,p=n+1),a>=0&&(c===r.charCodeAt(a)?-1==--a&&(o=n):(a=-1,o=p))}return i===o?o=p:-1===o&&(o=e.length),e.slice(i,o)}for(n=e.length-1;n>=0;--n)if(47===e.charCodeAt(n)){if(!s){i=n+1;break}}else-1===o&&(s=!1,o=n+1);return-1===o?"":e.slice(i,o)},extname:function(e){t(e);for(var r=-1,n=0,i=-1,o=!0,s=0,a=e.length-1;a>=0;--a){var p=e.charCodeAt(a);if(47!==p)-1===i&&(o=!1,i=a+1),46===p?-1===r?r=a:1!==s&&(s=1):-1!==r&&(s=-1);else if(!o){n=a+1;break}}return-1===r||-1===i||0===s||1===s&&r===i-1&&r===n+1?"":e.slice(r,i)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var r=t.dir||t.root,n=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+n:r+"/"+n:n}(0,e)},parse:function(e){t(e);var r={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return r;var n,i=e.charCodeAt(0),o=47===i;o?(r.root="/",n=1):n=0;for(var s=-1,a=0,p=-1,c=!0,l=e.length-1,u=0;l>=n;--l)if(47!==(i=e.charCodeAt(l)))-1===p&&(c=!1,p=l+1),46===i?-1===s?s=l:1!==u&&(u=1):-1!==s&&(u=-1);else if(!c){a=l+1;break}return-1===s||-1===p||0===u||1===u&&s===p-1&&s===a+1?-1!==p&&(r.base=r.name=0===a&&o?e.slice(1,p):e.slice(a,p)):(0===a&&o?(r.name=e.slice(1,s),r.base=e.slice(1,p)):(r.name=e.slice(a,s),r.base=e.slice(a,p)),r.ext=e.slice(s,p)),a>0?r.dir=e.slice(0,a-1):o&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};n.posix=n,e.exports=n},351:()=>{}},t={},function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}(209);var e,t},e.exports=t()},860:(e,t,r)=>{r(860),r(197);var n=r(766),i={headline:"Breaking Bad"},o=n.twig({id:"src/views/partials/header.twig",data:[{type:"raw",value:"\nHeader: ",position:{start:43,end:57}},{type:"output",position:{start:57,end:71},stack:[{type:"Twig.expression.type.variable",value:"headline",match:["headline"],position:{start:57,end:71}}]},{type:"raw",value:"
\n",position:{start:71,end:78}},{type:"raw",value:"\nLang: ",position:{start:146,end:158}},{type:"output",position:{start:158,end:168},stack:[{type:"Twig.expression.type.variable",value:"lang",match:["lang"],position:{start:158,end:168}}]},{type:"raw",value:"
\n",position:{start:168,end:168}}],allowInlineIncludes:!0,rethrow:!0,precompiled:!0});e.exports=e=>o.render(Object.assign({},i,e))},175:(e,t,r)=>{r(860),r(197);var n=r(766),i={headline:"Breaking Bad",lang:"en"},o=n.twig({id:"src/views/partials/people.twig",data:[{type:"raw",value:"\n",position:{start:33,end:34}},{type:"logic",token:{type:"Twig.logic.type.include",only:!1,ignoreMissing:!1,stack:[{type:"Twig.expression.type.string",value:"src/views/partials/header.twig"}],position:{start:34,end:61}},position:{start:34,end:61}},{type:"raw",value:"\n",position:{start:62,end:63}},{type:"raw",value:'\n\n ',position:{start:98,end:120}},{type:"logic",token:{type:"Twig.logic.type.for",keyVar:null,valueVar:"item",expression:[{type:"Twig.expression.type.variable",value:"people",match:["people"]}],position:{start:120,end:144},output:[{type:"raw",value:" ",position:{start:145,end:157}},{type:"output",position:{start:157,end:167},stack:[{type:"Twig.expression.type.variable",value:"item",match:["item"],position:{start:157,end:167}}]},{type:"raw",value:" \n ",position:{start:167,end:177}}]},position:{open:{start:120,end:144},close:{start:177,end:189}}},{type:"raw",value:" \n\n",position:{start:190,end:197}},{type:"raw",value:"\n",position:{start:234,end:235}},{type:"logic",token:{type:"Twig.logic.type.include",only:!1,ignoreMissing:!1,stack:[{type:"Twig.expression.type.string",value:"src/views/partials/star.twig"}],position:{start:235,end:270}},position:{start:235,end:270}}],allowInlineIncludes:!0,rethrow:!0,precompiled:!0});e.exports=e=>o.render(Object.assign({},i,e))},197:(e,t,r)=>{r(860),r(197);var n=r(766),i={headline:"Breaking Bad"},o=n.twig({id:"src/views/partials/star.twig",data:[{type:"raw",value:'++ Included partial ++
\n ',position:{start:0,end:0}}],allowInlineIncludes:!0,rethrow:!0,precompiled:!0});e.exports=e=>o.render(Object.assign({},i,e))},487:(e,t,r)=>{"use strict";e.exports=r.p+"img/stern.6adb226f.svg"}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e;r.g.importScripts&&(e=r.g.location+"");var t=r.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");if(n.length)for(var i=n.length-1;i>-1&&(!e||!/^http(s?):/.test(e));)e=n[i--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r.p=e})(),(()=>{"use strict";var e=r(175);const t=r.n(e)()({people:["Walter White","Jesse Pinkman"]});document.getElementById("content").innerHTML=t,console.log(">> app")})()})();
\ No newline at end of file
diff --git a/test/cases/_pug/js-tmpl-data-external-compile/expected/main.js b/test/cases/_pug/js-tmpl-data-external-compile/expected/main.js
index c0bf8373..3a17abcb 100644
--- a/test/cases/_pug/js-tmpl-data-external-compile/expected/main.js
+++ b/test/cases/_pug/js-tmpl-data-external-compile/expected/main.js
@@ -1 +1 @@
-(()=>{var e={323:e=>{function t(e){var t=""+e,n=r.exec(t);if(!n)return e;var a,i,o,u="";for(a=n.index,i=0;a]/,n={title:{create:e=>`My '${e}' title!`},a:"abc",b:123};e.exports=e=>function(e){var r,n="",i=e||{};return function(e,a,i){n=n+"Title: "+t(null==(r=i.create("customized"))?"":r)+" Param[a]: "+t(null==(r=e)?"":r)+"
Param[b]: "+t(null==(r=a)?"":r)+"
"}.call(this,"a"in i?i.a:"undefined"!=typeof a?a:void 0,"b"in i?i.b:"undefined"!=typeof b?b:void 0,"title"in i?i.title:"undefined"!=typeof title?title:void 0),n}(Object.assign(n,e))}},t={};function r(n){var a=t[n];if(void 0!==a)return a.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";var e=r(323),t=r.n(e);document.getElementById("root").innerHTML=t()({b:987}),console.log(">> main")})()})();
\ No newline at end of file
+(()=>{var e={323:e=>{function t(e){var t=""+e,n=r.exec(t);if(!n)return e;var a,i,o,u="";for(a=n.index,i=0;a]/,n={title:{create:e=>`My '${e}' title!`},a:"abc",b:123};e.exports=e=>function(e){var r,n="",i=e||{};return function(e,a,i){n=n+"Title: "+t(null==(r=i.create("customized"))?"":r)+" Param[a]: "+t(null==(r=e)?"":r)+"
Param[b]: "+t(null==(r=a)?"":r)+"
"}.call(this,"a"in i?i.a:"undefined"!=typeof a?a:void 0,"b"in i?i.b:"undefined"!=typeof b?b:void 0,"title"in i?i.title:"undefined"!=typeof title?title:void 0),n}(Object.assign({},n,e))}},t={};function r(n){var a=t[n];if(void 0!==a)return a.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";var e=r(323),t=r.n(e);document.getElementById("root").innerHTML=t()({b:987}),console.log(">> main")})()})();
\ No newline at end of file
diff --git a/test/cases/js-import-css-modules-cjs/expected/index.html b/test/cases/js-import-css-modules-cjs/expected/index.html
index 37af4fa5..91dc19d4 100644
--- a/test/cases/js-import-css-modules-cjs/expected/index.html
+++ b/test/cases/js-import-css-modules-cjs/expected/index.html
@@ -3,7 +3,7 @@
CJS
-
+
diff --git a/test/cases/js-import-css-modules-cjs/expected/js/main.09b19148.js b/test/cases/js-import-css-modules-cjs/expected/js/main.09b19148.js
deleted file mode 100644
index d508a0f3..00000000
--- a/test/cases/js-import-css-modules-cjs/expected/js/main.09b19148.js
+++ /dev/null
@@ -1 +0,0 @@
-(()=>{var __webpack_modules__={654:e=>{e.exports={red:"style__red--gvFM4","lime-green":"style__lime-green--joDXV",limeGreen:"style__lime-green--joDXV",royal_blue:"style__royal_blue--ATLkt",royalBlue:"style__royal_blue--ATLkt"}},449:(module,__unused_webpack_exports,__webpack_require__)=>{var{Eta}=__webpack_require__(742),eta=new Eta({}),data={},etaFn=function(it){let include=(e,t)=>this.render(e,t,options),includeAsync=(e,t)=>this.renderAsync(e,t,options),__eta={res:"",e:this.config.escapeFunction,f:this.config.filterFunction};function layout(e,t){__eta.layout=e,__eta.layoutData=t}with(it||{})__eta.res+='Hello World! \nRed: ',__eta.res+=__eta.e(styles.red),__eta.res+='
\nGreen: ',__eta.res+=__eta.e(styles.limeGreen),__eta.res+='
\nBlue: ',__eta.res+=__eta.e(styles.royalBlue),__eta.res+="
",__eta.layout&&(__eta.res=include(__eta.layout,{...it,body:__eta.res,...__eta.layoutData}));return __eta.res},templateFn=e=>etaFn.bind(eta)(Object.assign(data,e));module.exports=templateFn},742:(e,t,n)=>{"use strict";function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t$});class r{constructor(e){this.cache=void 0,this.cache=e}define(e,t){this.cache[e]=t}get(e){return this.cache[e]}remove(e){delete this.cache[e]}reset(){this.cache={}}load(e){this.cache=s({},this.cache,e)}}class a extends Error{constructor(e){super(e),this.name="Eta Error"}}class i extends a{constructor(e){super(e),this.name="EtaParser Error"}}class c extends a{constructor(e){super(e),this.name="EtaRuntime Error"}}class l extends a{constructor(e){super(e),this.name="EtaNameResolution Error"}}function o(e,t,n){const s=t.slice(0,n).split(/\n/),r=s.length,a=s[r-1].length+1;throw e+=" at line "+r+" col "+a+":\n\n "+t.split(/\n/)[r-1]+"\n "+Array(a).join(" ")+"^",new i(e)}function _(e,t,n,s){const r=t.split("\n"),a=Math.max(n-3,0),i=Math.min(r.length,n+3),l=s,o=r.slice(a,i).map((function(e,t){const s=t+a+1;return(s==n?" >> ":" ")+s+"| "+e})).join("\n"),_=new c((l?l+":"+n+"\n":"line "+n+"\n")+o+"\n\n"+e.message);throw _.name=e.name,_}const u=async function(){}.constructor;function p(e,t){const n=this.config,s=t&&t.async?u:Function;try{return new s(n.varName,"options",this.compileToString.call(this,e,t))}catch(n){throw n instanceof SyntaxError?new i("Bad template syntax\n\n"+n.message+"\n"+Array(n.message.length+1).join("=")+"\n"+this.compileToString.call(this,e,t)+"\n"):n}}function h(e,t){const n=this.config,s=t&&t.async,r=this.compileBody,a=this.parse.call(this,e);let i=`${n.functionHeader}\nlet include = (template, data) => this.render(template, data, options);\nlet includeAsync = (template, data) => this.renderAsync(template, data, options);\n\nlet __eta = {res: "", e: this.config.escapeFunction, f: this.config.filterFunction${n.debug?', line: 1, templateStr: "'+e.replace(/\\|"/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n")+'"':""}};\n\nfunction layout(path, data) {\n __eta.layout = path;\n __eta.layoutData = data;\n}${n.debug?"try {":""}${n.useWith?"with("+n.varName+"||{}){":""}\n\n${r.call(this,a)}\nif (__eta.layout) {\n __eta.res = ${s?"await includeAsync":"include"} (__eta.layout, {...${n.varName}, body: __eta.res, ...__eta.layoutData});\n}\n${n.useWith?"}":""}${n.debug?"} catch (e) { this.RuntimeErr(e, __eta.templateStr, __eta.line, options.filepath) }":""}\nreturn __eta.res;\n`;if(n.plugins)for(let e=0;e":">",'"':""","'":"'"};function f(e){return g[e]}const m={autoEscape:!0,autoFilter:!1,autoTrim:[!1,"nl"],cache:!1,cacheFilepaths:!0,debug:!1,escapeFunction:function(e){const t=String(e);return/[&<>"']/.test(t)?t.replace(/[&<>"']/g,f):t},filterFunction:e=>String(e),functionHeader:"",parse:{exec:"",interpolate:"=",raw:"~"},plugins:[],rmWhitespace:!1,tags:["<%","%>"],useWith:!1,varName:"it",defaultExtension:".eta"},y=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,x=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,b=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g;function w(e){return e.replace(/[.*+\-?^${}()|[\]\\]/g,"\\$&")}function v(e,t){return e.slice(0,t).split("\n").length}function k(e){const t=this.config;let n=[],s=!1,r=0;const a=t.parse;if(t.plugins)for(let n=0;n{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};(()=>{"use strict";var e=__webpack_require__(449),t=__webpack_require__.n(e),n=__webpack_require__(654),s=__webpack_require__.n(n);document.getElementById("root").innerHTML=t()({styles:s()})})()})();
\ No newline at end of file
diff --git a/test/cases/js-import-css-modules-cjs/expected/js/main.64fa9b92.js b/test/cases/js-import-css-modules-cjs/expected/js/main.64fa9b92.js
new file mode 100644
index 00000000..9ee13df4
--- /dev/null
+++ b/test/cases/js-import-css-modules-cjs/expected/js/main.64fa9b92.js
@@ -0,0 +1 @@
+(()=>{var __webpack_modules__={654:e=>{e.exports={red:"style__red--gvFM4","lime-green":"style__lime-green--joDXV",limeGreen:"style__lime-green--joDXV",royal_blue:"style__royal_blue--ATLkt",royalBlue:"style__royal_blue--ATLkt"}},449:(module,__unused_webpack_exports,__webpack_require__)=>{var{Eta}=__webpack_require__(742),eta=new Eta({}),data={},etaFn=function(it){let include=(e,t)=>this.render(e,t,options),includeAsync=(e,t)=>this.renderAsync(e,t,options),__eta={res:"",e:this.config.escapeFunction,f:this.config.filterFunction};function layout(e,t){__eta.layout=e,__eta.layoutData=t}with(it||{})__eta.res+='Hello World! \nRed: ',__eta.res+=__eta.e(styles.red),__eta.res+='
\nGreen: ',__eta.res+=__eta.e(styles.limeGreen),__eta.res+='
\nBlue: ',__eta.res+=__eta.e(styles.royalBlue),__eta.res+="
",__eta.layout&&(__eta.res=include(__eta.layout,{...it,body:__eta.res,...__eta.layoutData}));return __eta.res},templateFn=e=>etaFn.bind(eta)(Object.assign({},data,e));module.exports=templateFn},742:(e,t,n)=>{"use strict";function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t$});class r{constructor(e){this.cache=void 0,this.cache=e}define(e,t){this.cache[e]=t}get(e){return this.cache[e]}remove(e){delete this.cache[e]}reset(){this.cache={}}load(e){this.cache=s({},this.cache,e)}}class a extends Error{constructor(e){super(e),this.name="Eta Error"}}class i extends a{constructor(e){super(e),this.name="EtaParser Error"}}class c extends a{constructor(e){super(e),this.name="EtaRuntime Error"}}class l extends a{constructor(e){super(e),this.name="EtaNameResolution Error"}}function o(e,t,n){const s=t.slice(0,n).split(/\n/),r=s.length,a=s[r-1].length+1;throw e+=" at line "+r+" col "+a+":\n\n "+t.split(/\n/)[r-1]+"\n "+Array(a).join(" ")+"^",new i(e)}function _(e,t,n,s){const r=t.split("\n"),a=Math.max(n-3,0),i=Math.min(r.length,n+3),l=s,o=r.slice(a,i).map((function(e,t){const s=t+a+1;return(s==n?" >> ":" ")+s+"| "+e})).join("\n"),_=new c((l?l+":"+n+"\n":"line "+n+"\n")+o+"\n\n"+e.message);throw _.name=e.name,_}const u=async function(){}.constructor;function p(e,t){const n=this.config,s=t&&t.async?u:Function;try{return new s(n.varName,"options",this.compileToString.call(this,e,t))}catch(n){throw n instanceof SyntaxError?new i("Bad template syntax\n\n"+n.message+"\n"+Array(n.message.length+1).join("=")+"\n"+this.compileToString.call(this,e,t)+"\n"):n}}function h(e,t){const n=this.config,s=t&&t.async,r=this.compileBody,a=this.parse.call(this,e);let i=`${n.functionHeader}\nlet include = (template, data) => this.render(template, data, options);\nlet includeAsync = (template, data) => this.renderAsync(template, data, options);\n\nlet __eta = {res: "", e: this.config.escapeFunction, f: this.config.filterFunction${n.debug?', line: 1, templateStr: "'+e.replace(/\\|"/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n")+'"':""}};\n\nfunction layout(path, data) {\n __eta.layout = path;\n __eta.layoutData = data;\n}${n.debug?"try {":""}${n.useWith?"with("+n.varName+"||{}){":""}\n\n${r.call(this,a)}\nif (__eta.layout) {\n __eta.res = ${s?"await includeAsync":"include"} (__eta.layout, {...${n.varName}, body: __eta.res, ...__eta.layoutData});\n}\n${n.useWith?"}":""}${n.debug?"} catch (e) { this.RuntimeErr(e, __eta.templateStr, __eta.line, options.filepath) }":""}\nreturn __eta.res;\n`;if(n.plugins)for(let e=0;e":">",'"':""","'":"'"};function f(e){return g[e]}const m={autoEscape:!0,autoFilter:!1,autoTrim:[!1,"nl"],cache:!1,cacheFilepaths:!0,debug:!1,escapeFunction:function(e){const t=String(e);return/[&<>"']/.test(t)?t.replace(/[&<>"']/g,f):t},filterFunction:e=>String(e),functionHeader:"",parse:{exec:"",interpolate:"=",raw:"~"},plugins:[],rmWhitespace:!1,tags:["<%","%>"],useWith:!1,varName:"it",defaultExtension:".eta"},y=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,x=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,b=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g;function w(e){return e.replace(/[.*+\-?^${}()|[\]\\]/g,"\\$&")}function v(e,t){return e.slice(0,t).split("\n").length}function k(e){const t=this.config;let n=[],s=!1,r=0;const a=t.parse;if(t.plugins)for(let n=0;n{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};(()=>{"use strict";var e=__webpack_require__(449),t=__webpack_require__.n(e),n=__webpack_require__(654),s=__webpack_require__.n(n);document.getElementById("root").innerHTML=t()({styles:s()})})()})();
\ No newline at end of file
diff --git a/test/cases/js-import-css-modules-esm/expected/index.html b/test/cases/js-import-css-modules-esm/expected/index.html
index a6f1bbff..a8fec1f5 100644
--- a/test/cases/js-import-css-modules-esm/expected/index.html
+++ b/test/cases/js-import-css-modules-esm/expected/index.html
@@ -3,7 +3,7 @@
ESM
-
+
diff --git a/test/cases/js-import-css-modules-esm/expected/js/main.b360f9a6.js b/test/cases/js-import-css-modules-esm/expected/js/main.b360f9a6.js
new file mode 100644
index 00000000..4daccc7c
--- /dev/null
+++ b/test/cases/js-import-css-modules-esm/expected/js/main.b360f9a6.js
@@ -0,0 +1 @@
+(()=>{var __webpack_modules__={449:(module,__unused_webpack_exports,__webpack_require__)=>{var{Eta}=__webpack_require__(742),eta=new Eta({}),data={},etaFn=function(it){let include=(e,t)=>this.render(e,t,options),includeAsync=(e,t)=>this.renderAsync(e,t,options),__eta={res:"",e:this.config.escapeFunction,f:this.config.filterFunction};function layout(e,t){__eta.layout=e,__eta.layoutData=t}with(it||{})__eta.res+='Hello World! \nRed: ',__eta.res+=__eta.e(styles.red),__eta.res+='
\nGreen: ',__eta.res+=__eta.e(styles.limeGreen),__eta.res+='
\nBlue: ',__eta.res+=__eta.e(styles.royalBlue),__eta.res+="
",__eta.layout&&(__eta.res=include(__eta.layout,{...it,body:__eta.res,...__eta.layoutData}));return __eta.res},templateFn=e=>etaFn.bind(eta)(Object.assign({},data,e));module.exports=templateFn},742:(e,t,n)=>{"use strict";function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t$});class r{constructor(e){this.cache=void 0,this.cache=e}define(e,t){this.cache[e]=t}get(e){return this.cache[e]}remove(e){delete this.cache[e]}reset(){this.cache={}}load(e){this.cache=s({},this.cache,e)}}class a extends Error{constructor(e){super(e),this.name="Eta Error"}}class i extends a{constructor(e){super(e),this.name="EtaParser Error"}}class c extends a{constructor(e){super(e),this.name="EtaRuntime Error"}}class l extends a{constructor(e){super(e),this.name="EtaNameResolution Error"}}function o(e,t,n){const s=t.slice(0,n).split(/\n/),r=s.length,a=s[r-1].length+1;throw e+=" at line "+r+" col "+a+":\n\n "+t.split(/\n/)[r-1]+"\n "+Array(a).join(" ")+"^",new i(e)}function _(e,t,n,s){const r=t.split("\n"),a=Math.max(n-3,0),i=Math.min(r.length,n+3),l=s,o=r.slice(a,i).map((function(e,t){const s=t+a+1;return(s==n?" >> ":" ")+s+"| "+e})).join("\n"),_=new c((l?l+":"+n+"\n":"line "+n+"\n")+o+"\n\n"+e.message);throw _.name=e.name,_}const u=async function(){}.constructor;function h(e,t){const n=this.config,s=t&&t.async?u:Function;try{return new s(n.varName,"options",this.compileToString.call(this,e,t))}catch(n){throw n instanceof SyntaxError?new i("Bad template syntax\n\n"+n.message+"\n"+Array(n.message.length+1).join("=")+"\n"+this.compileToString.call(this,e,t)+"\n"):n}}function p(e,t){const n=this.config,s=t&&t.async,r=this.compileBody,a=this.parse.call(this,e);let i=`${n.functionHeader}\nlet include = (template, data) => this.render(template, data, options);\nlet includeAsync = (template, data) => this.renderAsync(template, data, options);\n\nlet __eta = {res: "", e: this.config.escapeFunction, f: this.config.filterFunction${n.debug?', line: 1, templateStr: "'+e.replace(/\\|"/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n")+'"':""}};\n\nfunction layout(path, data) {\n __eta.layout = path;\n __eta.layoutData = data;\n}${n.debug?"try {":""}${n.useWith?"with("+n.varName+"||{}){":""}\n\n${r.call(this,a)}\nif (__eta.layout) {\n __eta.res = ${s?"await includeAsync":"include"} (__eta.layout, {...${n.varName}, body: __eta.res, ...__eta.layoutData});\n}\n${n.useWith?"}":""}${n.debug?"} catch (e) { this.RuntimeErr(e, __eta.templateStr, __eta.line, options.filepath) }":""}\nreturn __eta.res;\n`;if(n.plugins)for(let e=0;e":">",'"':""","'":"'"};function f(e){return g[e]}const m={autoEscape:!0,autoFilter:!1,autoTrim:[!1,"nl"],cache:!1,cacheFilepaths:!0,debug:!1,escapeFunction:function(e){const t=String(e);return/[&<>"']/.test(t)?t.replace(/[&<>"']/g,f):t},filterFunction:e=>String(e),functionHeader:"",parse:{exec:"",interpolate:"=",raw:"~"},plugins:[],rmWhitespace:!1,tags:["<%","%>"],useWith:!1,varName:"it",defaultExtension:".eta"},y=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,x=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,b=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g;function w(e){return e.replace(/[.*+\-?^${}()|[\]\\]/g,"\\$&")}function v(e,t){return e.slice(0,t).split("\n").length}function F(e){const t=this.config;let n=[],s=!1,r=0;const a=t.parse;if(t.plugins)for(let n=0;n{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};(()=>{"use strict";var e=__webpack_require__(449),t=__webpack_require__.n(e);document.getElementById("root").innerHTML=t()({styles:{"lime-green":"style__lime-green--joDXV",limeGreen:"style__lime-green--joDXV",red:"style__red--gvFM4",royalBlue:"style__royal_blue--ATLkt",royal_blue:"style__royal_blue--ATLkt"}})})()})();
\ No newline at end of file
diff --git a/test/cases/js-import-css-modules-esm/expected/js/main.f73732d8.js b/test/cases/js-import-css-modules-esm/expected/js/main.f73732d8.js
deleted file mode 100644
index 18cb6589..00000000
--- a/test/cases/js-import-css-modules-esm/expected/js/main.f73732d8.js
+++ /dev/null
@@ -1 +0,0 @@
-(()=>{var __webpack_modules__={449:(module,__unused_webpack_exports,__webpack_require__)=>{var{Eta}=__webpack_require__(742),eta=new Eta({}),data={},etaFn=function(it){let include=(e,t)=>this.render(e,t,options),includeAsync=(e,t)=>this.renderAsync(e,t,options),__eta={res:"",e:this.config.escapeFunction,f:this.config.filterFunction};function layout(e,t){__eta.layout=e,__eta.layoutData=t}with(it||{})__eta.res+='Hello World! \nRed: ',__eta.res+=__eta.e(styles.red),__eta.res+='
\nGreen: ',__eta.res+=__eta.e(styles.limeGreen),__eta.res+='
\nBlue: ',__eta.res+=__eta.e(styles.royalBlue),__eta.res+="
",__eta.layout&&(__eta.res=include(__eta.layout,{...it,body:__eta.res,...__eta.layoutData}));return __eta.res},templateFn=e=>etaFn.bind(eta)(Object.assign(data,e));module.exports=templateFn},742:(e,t,n)=>{"use strict";function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t$});class r{constructor(e){this.cache=void 0,this.cache=e}define(e,t){this.cache[e]=t}get(e){return this.cache[e]}remove(e){delete this.cache[e]}reset(){this.cache={}}load(e){this.cache=s({},this.cache,e)}}class a extends Error{constructor(e){super(e),this.name="Eta Error"}}class i extends a{constructor(e){super(e),this.name="EtaParser Error"}}class c extends a{constructor(e){super(e),this.name="EtaRuntime Error"}}class l extends a{constructor(e){super(e),this.name="EtaNameResolution Error"}}function o(e,t,n){const s=t.slice(0,n).split(/\n/),r=s.length,a=s[r-1].length+1;throw e+=" at line "+r+" col "+a+":\n\n "+t.split(/\n/)[r-1]+"\n "+Array(a).join(" ")+"^",new i(e)}function _(e,t,n,s){const r=t.split("\n"),a=Math.max(n-3,0),i=Math.min(r.length,n+3),l=s,o=r.slice(a,i).map((function(e,t){const s=t+a+1;return(s==n?" >> ":" ")+s+"| "+e})).join("\n"),_=new c((l?l+":"+n+"\n":"line "+n+"\n")+o+"\n\n"+e.message);throw _.name=e.name,_}const u=async function(){}.constructor;function h(e,t){const n=this.config,s=t&&t.async?u:Function;try{return new s(n.varName,"options",this.compileToString.call(this,e,t))}catch(n){throw n instanceof SyntaxError?new i("Bad template syntax\n\n"+n.message+"\n"+Array(n.message.length+1).join("=")+"\n"+this.compileToString.call(this,e,t)+"\n"):n}}function p(e,t){const n=this.config,s=t&&t.async,r=this.compileBody,a=this.parse.call(this,e);let i=`${n.functionHeader}\nlet include = (template, data) => this.render(template, data, options);\nlet includeAsync = (template, data) => this.renderAsync(template, data, options);\n\nlet __eta = {res: "", e: this.config.escapeFunction, f: this.config.filterFunction${n.debug?', line: 1, templateStr: "'+e.replace(/\\|"/g,"\\$&").replace(/\r\n|\n|\r/g,"\\n")+'"':""}};\n\nfunction layout(path, data) {\n __eta.layout = path;\n __eta.layoutData = data;\n}${n.debug?"try {":""}${n.useWith?"with("+n.varName+"||{}){":""}\n\n${r.call(this,a)}\nif (__eta.layout) {\n __eta.res = ${s?"await includeAsync":"include"} (__eta.layout, {...${n.varName}, body: __eta.res, ...__eta.layoutData});\n}\n${n.useWith?"}":""}${n.debug?"} catch (e) { this.RuntimeErr(e, __eta.templateStr, __eta.line, options.filepath) }":""}\nreturn __eta.res;\n`;if(n.plugins)for(let e=0;e":">",'"':""","'":"'"};function f(e){return g[e]}const m={autoEscape:!0,autoFilter:!1,autoTrim:[!1,"nl"],cache:!1,cacheFilepaths:!0,debug:!1,escapeFunction:function(e){const t=String(e);return/[&<>"']/.test(t)?t.replace(/[&<>"']/g,f):t},filterFunction:e=>String(e),functionHeader:"",parse:{exec:"",interpolate:"=",raw:"~"},plugins:[],rmWhitespace:!1,tags:["<%","%>"],useWith:!1,varName:"it",defaultExtension:".eta"},y=/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g,x=/'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g,b=/"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g;function w(e){return e.replace(/[.*+\-?^${}()|[\]\\]/g,"\\$&")}function v(e,t){return e.slice(0,t).split("\n").length}function F(e){const t=this.config;let n=[],s=!1,r=0;const a=t.parse;if(t.plugins)for(let n=0;n{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};(()=>{"use strict";var e=__webpack_require__(449),t=__webpack_require__.n(e);document.getElementById("root").innerHTML=t()({styles:{"lime-green":"style__lime-green--joDXV",limeGreen:"style__lime-green--joDXV",red:"style__red--gvFM4",royalBlue:"style__royal_blue--ATLkt",royal_blue:"style__royal_blue--ATLkt"}})})()})();
\ No newline at end of file
diff --git a/test/preprocessor.test.js b/test/preprocessor.test.js
index 3f79b560..d9c79cec 100644
--- a/test/preprocessor.test.js
+++ b/test/preprocessor.test.js
@@ -99,6 +99,7 @@ describe('usage template in js on client side', () => {
// Handlebars
test('hbs: compile to fn', () => compareFiles('_preprocessor/js-tmpl-hbs-compile'));
test('hbs: compile to fn with partials', () => compareFiles('_preprocessor/js-tmpl-hbs-compile-partials'));
+ test('hbs: compile to fn with variables', () => compareFiles('_preprocessor/js-tmpl-hbs-compile-variables'));
// Nunjucks
test('njk: compile to fn', () => compareFiles('_preprocessor/js-tmpl-njk-compile'));