fix: also account for apply in dispose code

This commit is contained in:
Igor Randjelovic
2021-10-18 21:27:52 +02:00
parent b3b6ada8ce
commit 8bc1a43630

View File

@ -23,13 +23,19 @@ export default function loader(content, map) {
this.query this.query
); );
const disposeCode = options.apply
? dedent`
const { removeTaggedAdditionalCSS } = require("@nativescript/core/ui/styling/style-scope");
removeTaggedAdditionalCSS(${tag})
`
: ``;
const hmrCode = this.hot const hmrCode = this.hot
? dedent` ? dedent`
if(module.hot) { if(module.hot) {
module.hot.accept() module.hot.accept()
module.hot.dispose(() => { module.hot.dispose(() => {
const { removeTaggedAdditionalCSS } = require("@nativescript/core/ui/styling/style-scope"); ${disposeCode}
removeTaggedAdditionalCSS(${tag})
}) })
} }
` `