developit / microbundle

📦 Zero-configuration bundler for tiny modules.
https://npm.im/microbundle
MIT License
8.07k stars 363 forks source link

React component lib doesn't seem to work #462

Closed konsumer closed 5 years ago

konsumer commented 5 years ago

I have a component that looks like this:

import React from 'react'

export default () => (<div>HI</div>)

My package.json has this:

{
"source": "src/index.js",
  "main": "lib/index.js",
  "files": [
    "lib/index.js",
    "lib/index.mjs",
    "lib/index.umd.js"
  ],
  "scripts": {
    "build": "microbundle build --jsx React.createElement --external react -o lib"
  },
  "dependencies": {
    "react": "^16.9.0"
  }
}

This results in this error:

PROJECT: setting options.module is deprecated, please override options.mainFields instead
PROJECT: setting options.jsnext is deprecated, please override options.mainFields instead
PROJECT: setting options.module is deprecated, please override options.mainFields instead
PROJECT: setting options.jsnext is deprecated, please override options.mainFields instead
PROJECT: setting options.module is deprecated, please override options.mainFields instead
PROJECT: setting options.jsnext is deprecated, please override options.mainFields instead
(buble plugin) SyntaxError: Unexpected token (2:30)

at /home/konsumer/Documents/WORKSPACE/PROJECT/src/index.js:2:30

1 : import React from 'react';
2 : export default (() => <div>HI</div>);
                                  ^
ForsakenHarmony commented 5 years ago

can you try microbundle@next?

konsumer commented 5 years ago

That worked! I made a demo project. Thanks for the quick help @ForsakenHarmony !

ForsakenHarmony commented 5 years ago

Closing this to clean up issues, trying to figure out if we can release it as latest