Skip to content

Commit

Permalink
build(rollup): generate sourcemap for UMD build
Browse files Browse the repository at this point in the history
Release-As: 0.4.3
  • Loading branch information
remarkablemark committed Oct 14, 2023
1 parent cf73e87 commit 463e4b5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
"require": "./index.js"
},
"scripts": {
"build": "run-s build:*",
"build:min": "NODE_ENV=production rollup --config --file dist/style-to-object.min.js --sourcemap",
"build:unmin": "NODE_ENV=development rollup --config --file dist/style-to-object.js",
"build": "rollup --config --failAfterWarnings",
"clean": "rm -rf dist",
"lint": "eslint --ignore-path .gitignore .",
"lint:fix": "npm run lint -- --fix",
Expand Down
19 changes: 11 additions & 8 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@ import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';

const config = {
/**
* Build rollup config for development or production.
*/
const getConfig = (minify = false) => ({
input: 'index.js',
output: {
file: `dist/style-to-object${minify ? '.min' : ''}.js`,
format: 'umd',
name: 'StyleToObject'
name: 'StyleToObject',
sourcemap: true
},
plugins: [commonjs(), resolve()]
};
plugins: [commonjs(), resolve(), minify && terser()]
});

if (process.env.NODE_ENV === 'production') {
config.plugins.push(terser());
}
const configs = [getConfig(), getConfig(true)];

export default config;
export default configs;

0 comments on commit 463e4b5

Please sign in to comment.