Skip to content
Snippets Groups Projects
Unverified Commit 4f426e94 authored by Jack Reed's avatar Jack Reed Committed by GitHub
Browse files

Merge pull request #2930 from ProjectMirador/2929-deploy-es-and-cjs-modules

deploy es and cjs modules. closes #2929
parents 0521228b f14ddf24
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,11 @@
* compatible with IE11 and Edge.
*/
const moduleFormatMap = {
cjs: 'commonjs',
es: false,
};
// eslint-disable-next-line func-names
module.exports = function (api) {
const isDevelopmentEnv = api.env('development');
......@@ -26,7 +31,7 @@ module.exports = function (api) {
corejs: 3,
exclude: ['transform-typeof-symbol'],
forceAllTransforms: true,
modules: false,
modules: moduleFormatMap[process.env.MODULE_FORMAT] || false,
useBuiltIns: 'entry',
},
],
......
......@@ -16,9 +16,10 @@
"test:watch": "jest -c jest.json --watch",
"build": "webpack --mode=production",
"build:dev": "webpack --mode=development",
"build:es": "mkdir -p dist/es && cp -r src dist/es && babel dist/es -d dist/es",
"build:es": "mkdir -p dist/es && cp -r src dist/es && MODULE_FORMAT=es babel dist/es -d dist/es",
"build:cjs": "mkdir -p dist/cjs && cp -r src dist/cjs && MODULE_FORMAT=cjs babel dist/cjs -d dist/cjs",
"build:watch": "webpack --watch --mode=development",
"prepublishOnly": "npm run clean && npm run build:es && npm run build",
"prepublishOnly": "npm run clean && npm run build:es && npm run build:cjs && npm run build",
"size": "bundlewatch --config bundlewatch.config.json",
"start": "npm run build:dev && concurrently \"npm run build:watch\" \"npm run server -- -p 4444\"",
"server:json": "node ./scripts/json-server/server.js >> ./scripts/json-server/json-server.log"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment