ZachJW34/nx-plus

How to enable runtimeCompiler

AmbrosiaDevelopments opened this issue · 4 comments

Description

With Vue3, is there a way to turn on runtimeCompiler? I tried the existing PR that allows the vue.config.js file to be used as per this request but still couldn't seem to define the runtimeCompiler no matter how I tried. I want to configure custom elements during runtime using app.config.compilerOptions.isCustomElement but nx-plus/vue already has vue-loader configured so I can't change the options and add isCustomElement in configure-webpack.js. My custom elements are not in .vue files, they're defined in .ts files but the tags are used in the HTML of .vue files but they are continually loaded by Vue and show the warning despite my best efforts to have them ignored.

You can see what vue-cli does when you pass runtimeCompiler. Can you try setting the proper alias inside configure-webpack.js and see if that works?

I have explored what it does and how your project uses vue-loader which has led me to ask this instead of really push for the vue.config.js file to be added.

To provide the compilerOptions parameter I require vue-loader config to be customised. When I do so in configure-webpack.js it doesn't override the configuration predefined inside the nx-plus/vue project because you're already using that plugin. It doesn't let me override the compilerOptions.isCustomElement until I remove vue-loader from my fork and then I can define it in my other project's configure-webpack.js file.

I forked the project to add an ability to provide a list of customElement tags in a new config file. It worked but it's not how I'd like it to be.

I had to add this to configure-webpack.js to enable runtimeCompiler:

module.exports = (config) => {
  config.resolve.alias = {
    'vue$': 'vue/dist/vue.esm.js'
  }
};

I don't (yet?) know about the compilerOptions.isCustomElement though..

Beautiful, that works perfectly to turn it on, thank you. I'll keep plugging away at configuring vue-loader compilerOptions to register the custom elements and prevent the warning. Still not as straight forward as I would have hoped.