How to use the vue-template-compiler/package.json function in vue-template-compiler

To help you get started, we’ve selected a few vue-template-compiler examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ryanelian / instapack / src / CompilerResolver.ts View on Github external
export async function resolveVueTemplateCompiler(projectBasePath: string): Promise {
    console.log('FINDING VUE TEMPLATE COMPILER')

    const resolver: EnhancedResolver = ResolverFactory.createResolver({
        fileSystem: fse
    });

    const instapackVueCompilerVersion: string = require('vue-template-compiler/package.json')['version'];
    const vueVersion = await tryGetProjectPackageVersion(resolver, projectBasePath, 'vue');

    try {
        const vueCompilerVersion = await tryGetProjectPackageVersion(resolver, projectBasePath, 'vue-template-compiler');

        if (!vueVersion || !vueCompilerVersion) {
            throw new Error('Project Vue / Vue Template Compiler packages are not found.');
        }

        if (vueVersion !== vueCompilerVersion) {
            Shout.warning(`Project vue (${vueVersion}) and vue-template-compiler (${vueCompilerVersion}) version mismatch!`
                + chalk.grey(`
Fix the project package.json and make sure to use the same version for both:
    yarn add vue-template-compiler@${vueVersion} -D -E
                        OR
    npm install vue-template-compiler@${vueVersion} -D -E
github ryanelian / instapack / bin / CompilerResolver.js View on Github external
return __awaiter(this, void 0, void 0, function* () {
        console.log('FINDING VUE TEMPLATE COMPILER');
        const resolver = enhanced_resolve_1.ResolverFactory.createResolver({
            fileSystem: fse
        });
        const instapackVueCompilerVersion = require('vue-template-compiler/package.json')['version'];
        const vueVersion = yield tryGetProjectPackageVersion(resolver, projectBasePath, 'vue');
        try {
            const vueCompilerVersion = yield tryGetProjectPackageVersion(resolver, projectBasePath, 'vue-template-compiler');
            if (!vueVersion || !vueCompilerVersion) {
                throw new Error('Project Vue / Vue Template Compiler packages are not found.');
            }
            if (vueVersion !== vueCompilerVersion) {
                Shout_1.Shout.warning(`Project vue (${vueVersion}) and vue-template-compiler (${vueCompilerVersion}) version mismatch!`
                    + chalk.grey(`
Fix the project package.json and make sure to use the same version for both:
    yarn add vue-template-compiler@${vueVersion} -D -E
                        OR
    npm install vue-template-compiler@${vueVersion} -D -E
`));
                Shout_1.Shout.warning('Fallback to instapack default built-in Vue Template Compiler...');
                throw new Error('Project vue and vue-template-compiler version mismatched!');