@@ -12,15 +12,20 @@ import pkg from './package.json';
1212 * @param {PlainObject } config
1313 * @param {string } config.input
1414 * @param {boolean } config.minifying
15+ * @param {string[] } [config.external]
1516 * @param {string } [config.environment=""]
1617 * @param {string } [config.format="umd"]
1718 * @returns {external:RollupConfig }
1819 */
1920function getRollupObject ( {
20- input, minifying, environment, format = 'umd'
21+ input, minifying, environment,
22+ // eslint-disable-next-line no-shadow
23+ external,
24+ format = 'umd'
2125} ) {
2226 const nonMinified = {
2327 input,
28+ external,
2429 output : {
2530 format,
2631 sourcemap : minifying ,
@@ -63,9 +68,15 @@ function getRollupObject ({
6368function getRollupObjectByEnv ( { minifying, environment} ) {
6469 const input = `src/jsonpath-${ environment } .js` ;
6570 if ( environment === 'node' ) {
71+ // eslint-disable-next-line no-shadow
72+ const external = [ 'vm' ] ;
6673 return [
67- getRollupObject ( { input, minifying, environment, format : 'cjs' } ) ,
68- getRollupObject ( { input, minifying, environment, format : 'esm' } )
74+ getRollupObject ( {
75+ input, minifying, environment, external, format : 'cjs'
76+ } ) ,
77+ getRollupObject ( {
78+ input, minifying, environment, external, format : 'esm'
79+ } )
6980 ] ;
7081 }
7182 return [
@@ -74,7 +85,7 @@ function getRollupObjectByEnv ({minifying, environment}) {
7485 ] ;
7586}
7687
77- // eslint-disable-next-line import/no-anonymous-default-export
88+ // eslint-disable-next-line import/no-anonymous-default-export -- Rollup config
7889export default [
7990 ...getRollupObjectByEnv ( { minifying : false , environment : 'node' } ) ,
8091 // ...getRollupObjectByEnv({minifying: true, environment: 'node'}),
0 commit comments