Skip to content

Build errors out-of-the-box with Webpack 2 and UglifyJS #150

@ethanroday

Description

@ethanroday

Steps to reproduce:

  1. Create a new app using preact-cli
  2. Run npm i -D preact-material-components
  3. Add import Button from 'preact-material-components/Button'; in src/app.js
  4. Run npm run build

Result:

bundle.js from UglifyJs
Unexpected token: name (Button) [bundle.js:553,6]

This issue (or similar ones) can also be reproduced in both preact-boilerplate and PreactSimpleStarter. These are easier to play around with since they expose their Webpack configs.

It appears to be due to UglifyJS's lack of support for ES6. However, adding /node_modules/preact-material-components to babel-loader in Webpack config just results in different unexpected token errors.

#77 seems to imply that there is a UMD version for those of us targeting ES5. How do I make sure my build process picks that up?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions