react-toolkit icon indicating copy to clipboard operation
react-toolkit copied to clipboard

[Core] Compatibility issue with vite in 2.0.0-alpha.5

Open JLou opened this issue 3 years ago • 0 comments

Issue and Steps to Reproduce

When trying to use the package Button in a demo app with vite, I get the following error:

[plugin:vite:import-analysis] Failed to resolve import "prop-types" from "node_modules\@axa-fr\react-toolkit-core\dist\esm\Constants.js". Does the file exist?

C:[/dev/vite/node_modules/@axa-fr/react-toolkit-core/dist/esm/Constants.js:1:25]()

1  |  import { string } from 'prop-types';
   |                          ^
2  |  const propTypes = {
3  |      className: string,

    at formatError ([C:\dev\vite\node_modules\vite\dist\node\chunks\dep-9c153816.js:38098:46]())
    at TransformContext.error ([C:\dev\vite\node_modules\vite\dist\node\chunks\dep-9c153816.js:38094:19]())
    at normalizeUrl ([C:\dev\vite\node_modules\vite\dist\node\chunks\dep-9c153816.js:69819:26]())
    at async TransformContext.transform ([C:\dev\vite\node_modules\vite\dist\node\chunks\dep-9c153816.js:69959:57]())
    at async Object.transform ([C:\dev\vite\node_modules\vite\dist\node\chunks\dep-9c153816.js:38334:30]())
    at async doTransform ([C:\dev\vite\node_modules\vite\dist\node\chunks\dep-9c153816.js:53030:29]()

I setup a quick repo to reproduce: https://github.com/JLou/bug-vite-reproduction

Versions

2.0.0-alpha.5

Screenshots

image

Expected

should not crash :D

Actual

it crashes

Additional Details

  • Installed packages
  • "@axa-fr/react-toolkit-button": "^2.0.0-alpha.5",

JLou avatar Mar 10 '22 14:03 JLou