Skip to content

Unable to use a compiler proxy #1454

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
lucasmpaim opened this issue Dec 25, 2018 · 1 comment
Open

Unable to use a compiler proxy #1454

lucasmpaim opened this issue Dec 25, 2018 · 1 comment

Comments

@lucasmpaim
Copy link

lucasmpaim commented Dec 25, 2018

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.

@lucasmpaim lucasmpaim changed the title Not able to use a compiler proxy Unable to use a compiler proxy Dec 25, 2018
@viruscamp
Copy link

I met the same problem. I have temporarily fixed it by disable parallel in vue.config.js.
I think it is caused by the use of 'thread-loader', which is enabled default by vue-cli.

The main node process passes stringified webpack options (includes vue-loader options) to worker processes. Functions could not be passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants