DEV Community

loading...

Discussion on: Creating a package for Svelte

Collapse
khrome83 profile image
Zane Milakovic

Great write up.

What does the svelte part o the npm package do. I understand the standard entry point or module reference. What is actually using that?

Collapse
agustinl profile image
Agustín Author

Hey Zane, specifically which part are you referring to?

Collapse
khrome83 profile image
Zane Milakovic

‘’’
"main": "dist/index.js",
"module": "dist/index.mjs",
"svelte": "src/index.js",
"scripts": {
"build": "rollup -c",
"dev": "rollup -c -w"
},

‘’’

Just the svelte key in the package.json. What uses that?

Thread Thread
agustinl profile image
Agustín Author

From the svelte repository:

Your package.json has a "svelte" field pointing to src/index.js, which allows Svelte apps to import the source code directly, if they are using a bundler plugin like rollup-plugin-svelte or svelte-loader (where resolve.mainFields in your webpack config includes "svelte"). This is recommended.

👌

Thread Thread
khrome83 profile image
Zane Milakovic

Awesome! Ty.