webpack-encore icon indicating copy to clipboard operation
webpack-encore copied to clipboard

How can I transpileDependencies when using webpack encore

Open nimonimonimo opened this issue 1 year ago • 2 comments
trafficstars

Hi,

In my Symfony/VueJS/Vuetify project I am trying to use package vuetify tiptap WYSIWYG-editor. However, here: https://github.com/iliyaZelenko/tiptap-vuetify/issues/248#issuecomment-749354197 I can read that I need to add: transpileDependencies: [ /[\\/]node_modules[\\/]tiptap.*/ ], to module.exports in "config.vue.js". But this file is only parsed if using vue-cli -- which I am not.

Could someone help me figure out the syntax for adding transpilingDependencies to webpack.config.js?

Thanks in advance!

nimonimonimo avatar Dec 02 '23 10:12 nimonimonimo

Thank you for this issue. There has not been a lot of activity here for a while. Has this been resolved?

carsonbot avatar Sep 28 '24 12:09 carsonbot

Seem like it is still the same behavior -- ie: the dependencies are not transpiled.

nimonimonimo avatar Sep 28 '24 13:09 nimonimonimo

Option transpileDependencies from Vue CLI is a shortcut for configuring exclude rule option, see https://github.com/vuejs/vue-cli/blob/f0f254e4bc81ed322eeb9f7de346e987e845068e/packages/%40vue/cli-plugin-babel/index.js#L36-L96.

With Webpack Encore, if you configure Babel through Encore.configureBabel(), then you must use something like this:

Encore.configureBabel(() => {}, {
    exclude: /node_modules\/(?!(tiptap.*)\/)/
});

It will continue to exclude files from node_modules/ directory except files from node_modules/tipap/

Kocal avatar Feb 16 '25 16:02 Kocal