-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ES Module Format Support #5735
Comments
I opened a PR to correct the above issue: #5736 |
In case somebody else encounters this issue using Vite. I was able to work around it by forcing Vite to convert formiojs and its dependencies to ES Module using import commonjs from '@rollup/plugin-commonjs';
export default defineConfig({
plugins: [
commonjs({
include: [
/node_modules\/formiojs(\/|\/node_modules\/).*/, // Include formiojs and all sub-dependencies
],
}),
... I shouldn't have to this if formiojs would be configured correctly. Please have a look into this. Many people are moving on from Webpack to Vite and will run into this issue. It would be ideal if you provide the library in ES Module format |
Problem Description
I am using Vite as a bundler. Vite expects ES Module by default. CommonJS Format is automatically transformed to ES Module during development builds. But somehow I can't get it working with formiojs for production builds. It results in
exports is not defined
Error:. I guess this error originates in Vite not being able to convert formiojs from CommonJS to ES Module during production build. Therefore it still contains exports/require after bundling.
Currently formiojs only supports CommonJS as output format. When are gonna support ES Module output format?
Possible Solution
In addition to CommonJS format, also support ES Module format. So Vite could directly use this version instead of having to do the conversion by itself.
The text was updated successfully, but these errors were encountered: