Skip to content
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

Add support to transpile modules inside node_modules #1011

Closed
muhajirdev opened this issue Jul 2, 2017 · 9 comments
Closed

Add support to transpile modules inside node_modules #1011

muhajirdev opened this issue Jul 2, 2017 · 9 comments

Comments

@muhajirdev
Copy link

muhajirdev commented Jul 2, 2017

Take a look at vercel/next.js#706 .

I think it is necassary. Last time I tested, nuxtjs does transpile it in development mode. But not in production.

This feature request is available on Nuxt.js community (#c878)
@pi0
Copy link
Member

pi0 commented Jul 2, 2017

Hey @muhajirframe. Thanks for reference, we will keep track of comments and adding if actually needed. However i've not seen any popular library exporting not transpiled version (can you list some?). For tree shaking and advanced optimization, modules should create special esm builds, like bootstrap-vue or vue.js. Also if it is necessary for one special package as of vercel/next.js#706 (comment) mentioned, we can do similar thing with nuxt.config.js using build.extend (However It may cause uglifyjs problems too as it currently not supports esm modules and this is probably why prod builds are failing)

@pi0
Copy link
Member

pi0 commented Aug 14, 2017

From #1080 @lcx960324:

Hello.
It seems that babel-loader will skip transforming files in node_modules.
use the traditional way to config babel but it did't work.

    loaders: [
      {
        test: /iview.src.*js$/,
        use: {
          loader: 'babel-loader',
          options: {
            presets: ['es2015'],
            plugins: ['transform-runtime']
          }
        }
      },
//   below are default nuxt loaders config.

So I wonder is there any way to let babel transform files in node_modules.
Thank you. XD

@xpl
Copy link

xpl commented Sep 23, 2017

See ccxt/ccxt#225 (comment) (a solution that adds a Babel rule for transpiling a specific ES6 module in the node_modules folder). You can also remove the general /node_modules/ exclusion that way (by monkey-patching the config.module.rules object).

@maximivanov
Copy link

maximivanov commented Apr 12, 2018

To add some keywords for those googling: we had an issue with fat arrows not being transpiled and failing in IE11. To find out what was causing it I just searched for => over .nuxt/dist folder (in prod build). It appeared to be coming from latest query-string module written in ES6.
One solution would be to transpile it as stated above, we've just downgraded the module to v5 (which is plain ES5).

@pi0
Copy link
Member

pi0 commented Apr 12, 2018

We may ship https://github.com/AndersDJohnson/webpack-babel-env-deps into nuxt to support transition node_modules. Working with @atinux on it :)

@larsenwork
Copy link

@pi0 any updates on including https://github.com/AndersDJohnson/webpack-babel-env-deps into nuxt?

@gnuletik
Copy link

I'm also interested by this feature, I can use transpileDependencies in vue.config.js with the default template from vue-cli. doc here https://cli.vuejs.org/config/#transpiledependencies
I'm trying to import this plugin: https://github.com/alessiomaffeis/vue-picture-input

@lock
Copy link

lock bot commented Nov 1, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 1, 2018
@nuxt nuxt unlocked this conversation Feb 9, 2019
@manniL
Copy link
Member

manniL commented Feb 9, 2019

For all folks coming around: https://nuxtjs.org/api/configuration-build/#transpile

There is manual support for it.

@danielroe danielroe added the 2.x label Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants