diff --git a/package.json b/package.json index d156154..4dd10e4 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,8 @@ "version": "0.0.0-development", "description": "⚙️ String manipulation library", "main": "dist/index.js", - "module": "dist/index.mjs", - "browser": "dist/str.js", + "module": "dist/index_es.mjs", + "browser": "dist/index_umd.js", "types": "types/index.d.ts", "scripts": { "test": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' nyc --reporter=lcov mocha './src/**/*.spec.ts' -r ts-node/register", diff --git a/rollup.browser.config.js b/rollup.browser.config.js index b6938ac..50bbdf5 100644 --- a/rollup.browser.config.js +++ b/rollup.browser.config.js @@ -7,7 +7,7 @@ export default { input: './src/index.ts', output: [ { - file: pkg.browser, + file: './dist/str.js', format: 'iife', name: 'str', sourcemap: true @@ -18,6 +18,12 @@ export default { name: 'str', plugins: [terser()], sourcemap: true + }, + { + file: pkg.browser, + format: 'umd', + name: 'str', + plugins: [terser()], } ], external: [...Object.keys(pkg.dependencies || {})], diff --git a/rollup.config.js b/rollup.config.js index 5b68c31..30b28a3 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -23,16 +23,10 @@ export default { }, { dir: './dist', - entryFileNames: '[name].mjs', + entryFileNames: '[name]_es.mjs', format: 'es', sourcemap: false - // esModule: false }, - // { - // file: pkg.browser, - // format: 'iife', - // name: 'str' - // } ], external: [...Object.keys(pkg.dependencies || {})], plugins: [ @@ -52,7 +46,7 @@ export default { transform: (contents) => { const p = JSON.parse(contents.toString('utf8')) p.main = p.main.replace('dist/', '') - p.module = p.module.replace('dist/', '') + // p.module = p.module.replace('dist/', '') p.browser = p.browser.replace('dist/', '') return JSON.stringify(p, null, 2) }