Stun3R / strapi-sdk-js

πŸ“¦ Javascript SDK for your Strapi API
https://strapi-sdk-js.netlify.app
MIT License
143 stars 27 forks source link

Fix default import ufo dependency #181

Closed flavienrako closed 1 year ago

flavienrako commented 1 year ago

Types of changes

Description

Fix "export 'default' (imported as 'ufo') was not found in 'ufo'"

It fixes #182

Checklist:

netlify[bot] commented 1 year ago

Deploy Preview for strapi-sdk-js canceled.

Name Link
Latest commit a69e11f309ee6e413913d52168442d0d134f8480
Latest deploy log https://app.netlify.com/sites/strapi-sdk-js/deploys/64e39ce6de0dd900082e0f2a
codecov[bot] commented 1 year ago

Codecov Report

Merging #181 (a69e11f) into develop (8113f8d) will not change coverage. The diff coverage is 100.00%.

@@           Coverage Diff            @@
##           develop     #181   +/-   ##
========================================
  Coverage    96.42%   96.42%           
========================================
  Files            3        3           
  Lines          112      112           
  Branches        21       21           
========================================
  Hits           108      108           
  Misses           3        3           
  Partials         1        1           
Files Changed Coverage Ξ”
src/lib/strapi.ts 96.29% <100.00%> (ΓΈ)
Stun3R commented 1 year ago

I'm updating the PR as it is a mandatory hot fix so I can merge & release ASAP

Stun3R commented 1 year ago

After some try, I kept your change so we are fully using the tree-shaking but this will break old webpack app (nuxt2, vue2...). I will add to the documentation that old webpack app must use the following snippet to load the package:

config.module.rules.push({
    test: /\.mjs$/,
    include: /node_modules/,
    type: 'javascript/auto',
})

Example with nuxt2. Add this snippet to your nuxt.config.js file:

  build: {
    extend(config) {
      config.module.rules.push({
        test: /\.mjs$/,
        include: /node_modules/,
        type: 'javascript/auto',
      })
    },
  },