c8r / kit

Tools for developing, documenting, and testing React component libraries

Home Page:https://compositor.io/kit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Provide an ES5 build

IcanDivideBy0 opened this issue · comments

Currently using @compositor/webfont in a create-react-app fails to build the app:

yarn run v1.9.4
$ react-scripts build
Creating an optimized production build...
Failed to compile.

Failed to minify the code from this file: 

 	./node_modules/@compositor/webfont/index.js:5 

Read more here: http://bit.ly/2tRViJ9

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

How to reproduce:

npx create-react-app my-app
cd my-app
yarn
yarn add @compositor/webfont

# import '@compositor/webfont' anywhere in the app src

yarn build

Kit components are transpiled with babel on publish (https://github.com/c8r/kit/blob/master/core/package.json#L15) – can you ensure that your babel-loader is excluding the node_modules directory?

Kit components are transpiled, but webfont module isn't.

The problem comes only when using the webpack.optimize.UglifyJsPlugin (https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/config/webpack.config.prod.js#L293-L312)

Maybe the @compositor/webfont is not meant to be used alone ? Yet the mdx-deck module have it as direct dependency ... https://github.com/jxnblk/mdx-deck/blob/master/package.json#L25

This is problematic when using mdx-deck as a library, not with the cli ... so I'm kinda lost regarding where the issue should be tracked :/