Skip to content

Unable to use a compiler proxy #1454

Open
@lucasmpaim

Description

@lucasmpaim

Version

15.4.2

Reproduction link

https://github.com/lucasmpaim/testbuild

Steps to reproduce

run yarn build

What is expected?

The build has compiled without problem

What is actually happening?

raised a error compiler.parseComponent is not a function


Using this solution: vuejs/vue#3934 with vue-cli project

With this configuration:

  chainWebpack: config => {
    config.module.rule('vue')
      .use('vue-loader')
      .loader('vue-loader')
      .tap(options => {
        options.compiler = VueTemplateCompilerProxy
        options.compilerOptions.preserveWhitespace = false;
        return options
      })
  }

on build process I receive the exception: compiler.parseComponent is not a function, In development is working perfectly, in vue-loader/lib/index.js I put an console.log to check why this is happening, and I notice in sometimes the compiler is a blank object {}.
The log:

App.vue { parseComponent: [Function: parseComponent],
  compile: [Function: compile],
  compileToFunctions: [Function: compileToFunctions],
  ssrCompile: [Function: compile],
  ssrCompileToFunctions: [Function: compileToFunctions] }
App.vue { parseComponent: [Function: parseComponent],
  compile: [Function: compile],
  compileToFunctions: [Function: compileToFunctions],
  ssrCompile: [Function: compile],
  ssrCompileToFunctions: [Function: compileToFunctions] }
App.vue { parseComponent: [Function: parseComponent],
  compile: [Function: compile],
  compileToFunctions: [Function: compileToFunctions],
  ssrCompile: [Function: compile],
  ssrCompileToFunctions: [Function: compileToFunctions] }
App.vue {}
.....

Adding:

   if(options.compiler && !Object.keys(options.compiler).length) options.compiler = null

Before parser executes, everting work fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions