@repodog/rollup-config 1.1.6 → 1.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +4 -0
  2. package/index.cjs +4 -3
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -43,6 +43,10 @@ module.exports = {
43
43
 
44
44
  ### Environment variables
45
45
 
46
+ `MODULE_SYSTEM` = `'esm' || 'cjs'`
47
+
48
+ Sets `output.format`, directory name within `./dist` output, and the extension of the bundled output file. Default `'esm'`.
49
+
46
50
  `NODE_ENV` = `'prod' || 'production' || 'dev' || 'development'`
47
51
 
48
52
  When set to `'prod'` or `'production'`, terser mangles and compresses, the bundle analyser runs, and source maps are omitted.
package/index.cjs CHANGED
@@ -10,10 +10,11 @@ const { plugin: analyzer } = require('rollup-plugin-analyzer');
10
10
  const copy = require('rollup-plugin-copy');
11
11
  const sourcemaps = require('rollup-plugin-sourcemaps');
12
12
 
13
- const { NODE_ENV } = process.env;
13
+ const { MODULE_SYSTEM = 'esm', NODE_ENV } = process.env;
14
14
  const isProdEnv = NODE_ENV === 'production' || NODE_ENV === 'prod';
15
15
  const packageDir = process.cwd();
16
16
  const external = id => !id.startsWith('.') && !id.startsWith('/');
17
+ const outputExtension = MODULE_SYSTEM === 'esm' ? 'mjs' : 'cjs';
17
18
 
18
19
  const sourcemapPathTransform = sourcePath => {
19
20
  if (/node_modules/.test(sourcePath)) {
@@ -72,8 +73,8 @@ module.exports = (config = {}) => {
72
73
  }
73
74
  },
74
75
  output: {
75
- file: `${packageDir}/dist/main/index.mjs`,
76
- format: 'esm',
76
+ file: `${packageDir}/dist/${MODULE_SYSTEM}/index.${outputExtension}`,
77
+ format: MODULE_SYSTEM,
77
78
  sourcemap: true,
78
79
  sourcemapPathTransform,
79
80
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@repodog/rollup-config",
3
3
  "description": "The RepoDog Rollup config module.",
4
- "version": "1.1.6",
4
+ "version": "1.1.7",
5
5
  "author": "Dylan Aubrey",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/badbatch/repodog",