remove esm and use cjs output from plugins

This commit is contained in:
Raghunandan
2020-03-31 14:48:32 +02:00
committed by nikek
parent e4195998ce
commit b3a7057191
7 changed files with 55 additions and 51 deletions
+1 -1
View File
@@ -61,7 +61,7 @@
"inquirer": "^7.0.4",
"ora": "^4.0.3",
"react-dev-utils": "^10.2.0",
"react-scripts": "^3.4.0",
"react-scripts": "^3.4.1",
"recursive-readdir": "^2.2.2",
"replace-in-file": "^5.0.2",
"rollup": "^2.1.0",
+8 -10
View File
@@ -18,15 +18,13 @@ const rollup = require('rollup'); // "import" is not working for some reason...
import rollupConfig from './rollup.config';
export default async () => {
for (const config of rollupConfig) {
const inputOptions = {
input: config.input,
plugins: config.plugins,
};
const outputOptions = config.output;
const inputOptions = {
input: rollupConfig.input,
plugins: rollupConfig.plugins,
};
const outputOptions = rollupConfig.output;
const bundle = await rollup.rollup(inputOptions);
await bundle.generate(outputOptions);
await bundle.write(outputOptions);
}
const bundle = await rollup.rollup(inputOptions);
await bundle.generate(outputOptions);
await bundle.write(outputOptions);
};
@@ -21,34 +21,21 @@ import resolve from '@rollup/plugin-node-resolve';
import postcss from 'rollup-plugin-postcss';
import image from 'rollup-plugin-image-files';
const plugins = [
peerDepsExternal(),
resolve(),
commonjs({
include: ['node_modules/**', '../../node_modules/**'],
exclude: ['**/*.stories.js'],
}),
postcss(),
image(),
typescript(),
];
export default [
{
input: 'src/index.ts',
output: {
file: 'build/index.esm.js',
format: 'esm',
sourcemap: true,
},
plugins,
export default {
input: 'src/index.ts',
output: {
file: 'build/index.cjs.js',
format: 'cjs',
},
{
input: 'src/index.ts',
output: {
file: 'build/index.cjs.js',
format: 'cjs',
},
plugins,
},
];
plugins: [
peerDepsExternal(),
resolve(),
commonjs({
include: ['node_modules/**', '../../node_modules/**'],
exclude: ['**/*.stories.js'],
}),
postcss(),
image(),
typescript(),
],
};
@@ -1,7 +1,7 @@
{
"name": "@backstage/plugin-{{id}}",
"version": "{{version}}",
"main": "build/index.esm.js",
"main": "build/index.cjs.js",
"types": "build/index.d.ts",
"license": "Apache-2.0",
"private": true,
-1
View File
@@ -2,7 +2,6 @@
"name": "@backstage/plugin-home-page",
"version": "0.1.1-alpha.0",
"main": "build/index.cjs.js",
"module": "build/index.esm.js",
"types": "build/index.d.ts",
"license": "Apache-2.0",
"private": false,
-1
View File
@@ -2,7 +2,6 @@
"name": "@backstage/plugin-welcome",
"version": "0.1.1-alpha.0",
"main": "build/index.cjs.js",
"module": "build/index.esm.js",
"types": "build/index.d.ts",
"private": false,
"license": "Apache-2.0",
+28 -7
View File
@@ -6669,6 +6669,14 @@ cross-env@^7.0.0:
dependencies:
cross-spawn "^7.0.1"
cross-fetch@^3.0.4:
version "3.0.4"
resolved "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.0.4.tgz#7bef7020207e684a7638ef5f2f698e24d9eb283c"
integrity sha512-MSHgpjQqgbT/94D4CyADeNoYh52zMkCX4pcJvPP5WqPsLFMKjr2TCMg381ox5qI0ii2dPwaLx/00477knXqXVw==
dependencies:
node-fetch "2.6.0"
whatwg-fetch "3.0.0"
cross-spawn-promise@^0.10.1:
version "0.10.2"
resolved "https://registry.npmjs.org/cross-spawn-promise/-/cross-spawn-promise-0.10.2.tgz#0e6338149caf53a6d557ac5c65efb3086d8704ac"
@@ -11192,6 +11200,14 @@ jest-environment-node@^25.1.0:
jest-mock "^25.1.0"
jest-util "^25.1.0"
jest-fetch-mock@^3.0.3:
version "3.0.3"
resolved "https://registry.npmjs.org/jest-fetch-mock/-/jest-fetch-mock-3.0.3.tgz#31749c456ae27b8919d69824f1c2bd85fe0a1f3b"
integrity sha512-Ux1nWprtLrdrH4XwE7O7InRY6psIi3GOsqNESJgMJ+M5cv4A8Lh7SN9d2V2kKRZ8ebAfcd1LNyZguAOb6JiDqw==
dependencies:
cross-fetch "^3.0.4"
promise-polyfill "^8.1.3"
jest-get-type@^24.9.0:
version "24.9.0"
resolved "https://registry.npmjs.org/jest-get-type/-/jest-get-type-24.9.0.tgz#1684a0c8a50f2e4901b6644ae861f579eed2ef0e"
@@ -13497,6 +13513,11 @@ node-fetch-npm@^2.0.2:
json-parse-better-errors "^1.0.0"
safe-buffer "^5.1.1"
node-fetch@2.6.0, node-fetch@^2.3.0, node-fetch@^2.5.0, node-fetch@^2.6.0:
version "2.6.0"
resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd"
integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==
node-fetch@^1.0.1:
version "1.7.3"
resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz#980f6f72d85211a5347c6b2bc18c5b84c3eb47ef"
@@ -13505,11 +13526,6 @@ node-fetch@^1.0.1:
encoding "^0.1.11"
is-stream "^1.0.1"
node-fetch@^2.3.0, node-fetch@^2.5.0, node-fetch@^2.6.0:
version "2.6.0"
resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd"
integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==
node-forge@0.9.0:
version "0.9.0"
resolved "https://registry.npmjs.org/node-forge/-/node-forge-0.9.0.tgz#d624050edbb44874adca12bb9a52ec63cb782579"
@@ -15665,6 +15681,11 @@ promise-inflight@^1.0.1, promise-inflight@~1.0.1:
resolved "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz#98472870bf228132fcbdd868129bad12c3c029e3"
integrity sha1-mEcocL8igTL8vdhoEputEsPAKeM=
promise-polyfill@^8.1.3:
version "8.1.3"
resolved "https://registry.npmjs.org/promise-polyfill/-/promise-polyfill-8.1.3.tgz#8c99b3cf53f3a91c68226ffde7bde81d7f904116"
integrity sha512-MG5r82wBzh7pSKDRa9y+vllNHz3e3d4CNj1PQE4BQYxLme0gKYYBm9YENq+UkEikyZ0XbiGWxYlVw3Rl9O/U8g==
promise-retry@^1.1.1:
version "1.1.1"
resolved "https://registry.npmjs.org/promise-retry/-/promise-retry-1.1.1.tgz#6739e968e3051da20ce6497fb2b50f6911df3d6d"
@@ -16223,7 +16244,7 @@ react-router@5.1.2:
tiny-invariant "^1.0.2"
tiny-warning "^1.0.0"
react-scripts@^3.4.0:
react-scripts@^3.4.1:
version "3.4.1"
resolved "https://registry.npmjs.org/react-scripts/-/react-scripts-3.4.1.tgz#f551298b5c71985cc491b9acf3c8e8c0ae3ada0a"
integrity sha512-JpTdi/0Sfd31mZA6Ukx+lq5j1JoKItX7qqEK4OiACjVQletM1P38g49d9/D0yTxp9FrSF+xpJFStkGgKEIRjlQ==
@@ -19611,7 +19632,7 @@ whatwg-encoding@^1.0.1, whatwg-encoding@^1.0.3, whatwg-encoding@^1.0.5:
dependencies:
iconv-lite "0.4.24"
whatwg-fetch@>=0.10.0, whatwg-fetch@^3.0.0:
whatwg-fetch@3.0.0, whatwg-fetch@>=0.10.0, whatwg-fetch@^3.0.0:
version "3.0.0"
resolved "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz#fc804e458cc460009b1a2b966bc8817d2578aefb"
integrity sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q==