Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.

Webpack 2.2.x, Babel 6 with Uglify ... #294

Closed
a-marcel opened this issue Feb 3, 2017 · 1 comment
Closed

Webpack 2.2.x, Babel 6 with Uglify ... #294

a-marcel opened this issue Feb 3, 2017 · 1 comment

Comments

@a-marcel
Copy link

a-marcel commented Feb 3, 2017

Hello,

if i try to build my project for production and use Uglify for this i get the error

Module build failed: ReferenceError: [BABEL] node_modules/preact-compat/node_modules/proptypes/index.js: Using removed Babel 5 option: node_modules/preact-compat/node_modules/proptypes/.babelrc.loose - Specify the loose option for the relevant plugin you are using or use a preset that sets the option.

It's not the same like #155 - because for the production build, i need to transpile the preact-compat project otherwise its not buildable.

My loader is:

{
                test: /\.js?$/,
                include: [
                  path.resolve('./src'),
                  path.resolve('./node_modules/preact-compat'),
                ],
                loader: 'babel-loader',
                query: {
                    plugins: [
                      'transform-runtime',
                      ["transform-react-jsx", { "pragma":"h" }]
                    ]
                },
            },

the easiest solution will be a vanilla javascript src/index.js file in that plugin so that there is no need for a transformation to js.

Thanks
Marcel

@developit
Copy link
Member

developit commented Feb 3, 2017

Vanilla JavaScript in a context where ES Modules is present would be ES2015, and that's what index.js is. The issue you ran into is actually just because the proptypes package uses Babel 5, and your babel-loader configuration is recursively looking for .babelrc files. It finds the one in node_modules/proptypes but can't use it because the options are for Babel 5. That said, it's silly for proptypes to include the .babelrc, it was a mistake and I've removed it. The fix is published as [email protected].

TL;DR: Just run npm update and all should be well :)

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

No branches or pull requests

2 participants