Fix tests by building two versions of plugins and importing/exporting seperatly
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
cjs/
|
||||
esm/
|
||||
types/
|
||||
build/
|
||||
|
||||
# Logs
|
||||
logs
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable notice/notice */
|
||||
export { default as HomePagePlugin } from '@backstage/plugin-home-page';
|
||||
export { default as WelcomePlugin } from '@backstage/plugin-welcome';
|
||||
import { default as HomePagePlugin } from '@backstage/plugin-home-page';
|
||||
import { default as WelcomePlugin } from '@backstage/plugin-welcome';
|
||||
export { HomePagePlugin, WelcomePlugin };
|
||||
|
||||
@@ -18,13 +18,15 @@ const rollup = require('rollup'); // "import" is not working for some reason...
|
||||
import rollupConfig from './rollup.config';
|
||||
|
||||
export default async () => {
|
||||
const inputOptions = {
|
||||
input: rollupConfig.input,
|
||||
plugins: rollupConfig.plugins,
|
||||
};
|
||||
const outputOptions = rollupConfig.output;
|
||||
for (const config of rollupConfig) {
|
||||
const inputOptions = {
|
||||
input: config.input,
|
||||
plugins: config.plugins,
|
||||
};
|
||||
const outputOptions = config.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,23 +21,34 @@ import resolve from '@rollup/plugin-node-resolve';
|
||||
import postcss from 'rollup-plugin-postcss';
|
||||
import image from 'rollup-plugin-image-files';
|
||||
|
||||
export default {
|
||||
input: 'src/index.ts',
|
||||
output: {
|
||||
file: 'build/index.esm.js',
|
||||
format: 'esm',
|
||||
sourcemap: true,
|
||||
},
|
||||
const plugins = [
|
||||
peerDepsExternal(),
|
||||
resolve(),
|
||||
commonjs({
|
||||
include: ['node_modules/**', '../../node_modules/**'],
|
||||
exclude: ['**/*.stories.js'],
|
||||
}),
|
||||
postcss(),
|
||||
image(),
|
||||
typescript(),
|
||||
];
|
||||
|
||||
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,
|
||||
},
|
||||
{
|
||||
input: 'src/index.ts',
|
||||
output: {
|
||||
file: 'build/index.cjs.js',
|
||||
format: 'cjs',
|
||||
},
|
||||
plugins,
|
||||
},
|
||||
];
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"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",
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
{
|
||||
"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",
|
||||
"license": "Apache-2.0",
|
||||
"private": false,
|
||||
"license": "Apache-2.0",
|
||||
"scripts": {
|
||||
"build": "backstage-cli build-cache -- backstage-cli plugin:build",
|
||||
"lint": "backstage-cli lint",
|
||||
|
||||
Reference in New Issue
Block a user