Nuxt.js: Add a babel plugin to nuxt-babel options

Created on 16 Aug 2019  路  3Comments  路  Source: nuxt/nuxt.js

Version

v2.8.1

Reproduction link

https://www.npmjs.com/package/babel-plugin-transform-remove-console

Steps to reproduce

Create nuxt project

In nuxt.config.js place:
babel: { babelrc: true, cacheDirectory: undefined, presets: ["@nuxt/babel-preset-app"] },

In .babelrc file place:

{ "env": { "production": { "plugins": ["transform-remove-console"] } } }

In terminal/console do: npm install babel-plugin-transform-remove-console --save

What is expected ?

I expect that the babel plugin is loaded and being run, in this case stripping all my console logs

What is actually happening?

It's not working, it seems like it's not being loaded at all.

This bug report is available on Nuxt community (#c9648)
bug-report

Most helpful comment

Any reason it won't work out with build.babel.plugins as shown in https://twitter.com/TheAlexLichter/status/1058296116876320769 ? :thinking:

All 3 comments

Any reason it won't work out with build.babel.plugins as shown in https://twitter.com/TheAlexLichter/status/1058296116876320769 ? :thinking:

That work does work out! It is just an option i did not came accross!
I followed whatever was on this page: https://nuxtjs.org/api/configuration-build/ and went by that.
But this is what i needed so thanks for that :)

what was the full solution again?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

surmon-china picture surmon-china  路  3Comments

jaredreich picture jaredreich  路  3Comments

lazycrazy picture lazycrazy  路  3Comments

vadimsg picture vadimsg  路  3Comments

bimohxh picture bimohxh  路  3Comments