Git Product home page Git Product logo

Comments (5)

jbruwes avatar jbruwes commented on June 2, 2024

Or even if it's possible:

"exports": {
".": {
"import": "./dist/vue3-sfc-loader-node.mjs",
"require": "./dist/vue3-sfc-loader-node.js"
},
"./esm": "./dist/vue3-sfc-loader.esm.js",
"./umd": "./dist/vue3-sfc-loader.js",
},

from vue3-sfc-loader.

FranckFreiburger avatar FranckFreiburger commented on June 2, 2024

The following export should work with all combinations I want to support:

nodejs for server-side compilation/caching (https://nodejs.org/api/packages.html#conditional-exports)
vitejs (https://vitejs.dev/config/shared-options.html#resolve-conditions)
webpack (https://webpack.js.org/guides/package-exports/#conditions)
jsdelivr CDN (https://www.jsdelivr.com/documentation#id-configuring-a-default-file-in-packagejson)

  "browser": "./dist/vue3-sfc-loader.js",
  "main": "./dist/vue3-sfc-loader.js",
  "module": "./dist/vue3-sfc-loader.esm.js",
  "types": "./dist/types/vue3-esm/index.d.ts",
  "exports": {
    ".": {
      "node": {
        "import": "./dist/vue3-sfc-loader-node.mjs",
        "require": "./dist/vue3-sfc-loader-node.js"
      },
      "import": "./dist/vue3-sfc-loader.esm.js",
      "require": "./dist/vue3-sfc-loader.js"
    },
    "./vue2": {
      "node": {
        "import": "./dist/vue2-sfc-loader-node.mjs",
        "require": "./dist/vue2-sfc-loader-node.js"
      },
      "import": "./dist/vue2-sfc-loader.esm.js",
      "require": "./dist/vue2-sfc-loader.js"
    },
    "./dist/*": "./dist/*",
    "./package.json": "./package.json"
  },

from vue3-sfc-loader.

FranckFreiburger avatar FranckFreiburger commented on June 2, 2024

for the record, you said earlier:

I opened a new issue for the topic, please take a look: #179

As for the context, I'll try to explain.

Suppose, that you have a nodejs environment on your PC. Let's go step by step:

  1. Import your absolutly brilliant library and develop the vite+vue software (node)
  2. Buid the software (vite build). Literally, vite package all files in the assets directory (node)
  3. Deploy the software to the static hosting without nodejs environment
  4. Open the software in an appropriate browser (browser)

In a few words, before the version 0.9.2 the vite had packaged esm version of the vue3-sfc-loader in the step 2, and in the step 4 a user obtained esm version of the vue3-sfc-loader.

Since the version 0.9.2, the vite is has packaged the node version of the vue3-sfc-loader and a user get errors in the step 4.

from vue3-sfc-loader.

jbruwes avatar jbruwes commented on June 2, 2024

Franck, your solution is even better. Absolutely perfect!

from vue3-sfc-loader.

FranckFreiburger avatar FranckFreiburger commented on June 2, 2024

closed by 55b8d72

from vue3-sfc-loader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.