You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A clear and concise description of what the feature is
I noticed that there are three configurations in the rollup configuration file rollup.config.mjs , one in commonJS format, one in ES module format, and one IIFE.
When I tried to use this sdk in a frontend project (like Vue or React) as what the README said, since CommonJS and ES Module have browser: false, preferBuiltins: true configured, this means they will prioritize using node modules, causing browser compatibility issues. (For details, please refer to issue #61 .)
Do you plan to add a browser-compatible ES Module to the compiled output formats? Or I missed a better practice? Or I should just turn to RESTful api?
Why should this feature be included?
I think using a <script> tag in Vue/React project is not appropriate.
Please provide an example for how this would work
When using import { strapi } from '@strapi/client'; it actually use bundle.mjs which prefer built-in modules.
I tried to modify rollup.config.mjs and built a browser compatible ES module (output like bundle.browser.esm.js).
Then I modified Vite config of my own project to use the new file.
Then everything goes well.
The text was updated successfully, but these errors were encountered:
A clear and concise description of what the feature is
I noticed that there are three configurations in the rollup configuration file
rollup.config.mjs
, one in commonJS format, one in ES module format, and one IIFE.When I tried to use this sdk in a frontend project (like Vue or React) as what the README said, since CommonJS and ES Module have
browser: false, preferBuiltins: true
configured, this means they will prioritize using node modules, causing browser compatibility issues. (For details, please refer to issue #61 .)Do you plan to add a browser-compatible ES Module to the compiled output formats? Or I missed a better practice? Or I should just turn to RESTful api?
Why should this feature be included?
I think using a
<script>
tag in Vue/React project is not appropriate.Please provide an example for how this would work
When using
import { strapi } from '@strapi/client';
it actually usebundle.mjs
which prefer built-in modules.I tried to modify
rollup.config.mjs
and built a browser compatible ES module (output likebundle.browser.esm.js
).Then I modified Vite config of my own project to use the new file.
Then everything goes well.
The text was updated successfully, but these errors were encountered: