KaiHotz / react-rollup-boilerplate

Boilerplate for creating React component libraries, bundled with Rollup.js to ESM and/or CJS Modules, Storybook, Typescript
https://kaihotz.github.io/react-rollup-boilerplate/
MIT License
300 stars 67 forks source link

Running build:watch throws error #24

Closed SebastianSchenk closed 2 years ago

SebastianSchenk commented 2 years ago

Running yarn build:watch throws the following error:

Error: You have declared using "runtime" babelHelpers, but transforming path/to/src/index.ts resulted in "inline". Please check your configuration.

yarn build runs without any problems, but I can*t find the difference.

SebastianSchenk commented 2 years ago

So it seams the reason for that error is the configuration of '@babel/plugin-transform-runtime'. helpers is set to !isDevelopment. So if NODE_ENV is not production, helpers will be inlined. However, the babel plugin in rollup is configured to always use runtime. Changing this line to isDevelopment ? 'inline' : 'runtime' will fix this error.

Nevertheless, now there is a new error (warning):

(!) Error when using sourcemap for reporting an error: Can't resolve original location of error.
src/components/button/index.tsx (2:12)
(!) `this` has been rewritten to `undefined`
https://rollupjs.org/guide/en/#error-this-is-undefined
src/components/button/index.tsx
KaiHotz commented 2 years ago

Hi sorry fro the late response, never mind the yarn build:watch script, it is no longer needed. when running yarn start storybook will automatically rebuild and on each save.

i will remove yarn build:watch