feat(webpack): try resolving compiler, but don't fail if not found

This commit is contained in:
Igor Randjelovic
2021-08-29 18:28:14 +02:00
committed by Nathan Walker
parent 9ce48f42fd
commit 97dda95024

View File

@ -32,7 +32,7 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
.tap((options) => {
return {
...options,
compiler: require('nativescript-vue-template-compiler'),
compiler: getTemplateCompiler(),
};
});
@ -117,3 +117,11 @@ function patchVueLoaderForHMR() {
error('Failed to patch VueLoader - HMR may not work properly!');
}
}
function getTemplateCompiler() {
try {
return require('nativescript-vue-template-compiler');
} catch (err) {
// ignore
}
}