Add ESM build

pull/12/head
Nikita Karamov 2020-06-26 17:17:49 +02:00
parent 78da7f7fb9
commit ab1ee0613a
No known key found for this signature in database
GPG Key ID: E40DFE6E993540FF
2 changed files with 8 additions and 1 deletions

View File

@ -22,9 +22,11 @@
"url": "https://karamoff.dev" "url": "https://karamoff.dev"
}, },
"main": "./dist/shareon.cjs", "main": "./dist/shareon.cjs",
"module": "./dist/shareon.mjs",
"unpkg": "./dist/shareon.min.js", "unpkg": "./dist/shareon.min.js",
"exports": { "exports": {
"require": "./dist/shareon.cjs" "require": "./dist/shareon.cjs",
"import": "./dist/shareon.mjs"
}, },
"files": [ "files": [
"dist" "dist"

View File

@ -70,6 +70,11 @@ if (isDev) {
format: 'cjs', format: 'cjs',
file: `${outputDir}${pkg.name}.cjs`, file: `${outputDir}${pkg.name}.cjs`,
}); });
output.push({
name: pkg.name,
format: 'esm',
file: `${outputDir}${pkg.name}.mjs`,
});
output.push({ output.push({
name: pkg.name, name: pkg.name,
format: 'iife', format: 'iife',