fix(graphql-docs/build): rollup error thrown during build

- during the dts transformation, the css import was not recognized, hence marking it as external in the dts transform didn't throw the error

- "extract: true" in postcss plugin makes sure it gets extracted to the final bundle as well

Signed-off-by: Anik Das <anikdas0811@gmail.com>
This commit is contained in:
Anik Das 2023-09-30 09:49:02 +05:30
parent 08ceed86a8
commit 64019f8ecf
3 changed files with 24 additions and 23 deletions

View File

@ -3,7 +3,8 @@
Bruno is being developed as a desktop app. You need to load the app by running the nextjs app in one terminal and then run the electron app in another terminal. Bruno is being developed as a desktop app. You need to load the app by running the nextjs app in one terminal and then run the electron app in another terminal.
### Dependencies ### Dependencies
* NodeJS v18
- NodeJS v18
### Local Development ### Local Development
@ -15,7 +16,6 @@ nvm use
npm i --legacy-peer-deps npm i --legacy-peer-deps
# build graphql docs # build graphql docs
# note: you can for now ignore the error thrown while building the graphql docs
npm run build:graphql-docs npm run build:graphql-docs
# build bruno query # build bruno query

View File

@ -1,46 +1,48 @@
const { nodeResolve } = require("@rollup/plugin-node-resolve"); const { nodeResolve } = require('@rollup/plugin-node-resolve');
const commonjs = require("@rollup/plugin-commonjs"); const commonjs = require('@rollup/plugin-commonjs');
const typescript = require("@rollup/plugin-typescript"); const typescript = require('@rollup/plugin-typescript');
const dts = require("rollup-plugin-dts"); const dts = require('rollup-plugin-dts');
const postcss = require("rollup-plugin-postcss"); const postcss = require('rollup-plugin-postcss');
const { terser } = require("rollup-plugin-terser"); const { terser } = require('rollup-plugin-terser');
const peerDepsExternal = require('rollup-plugin-peer-deps-external'); const peerDepsExternal = require('rollup-plugin-peer-deps-external');
const packageJson = require("./package.json"); const packageJson = require('./package.json');
module.exports = [ module.exports = [
{ {
input: "src/index.ts", input: 'src/index.ts',
output: [ output: [
{ {
file: packageJson.main, file: packageJson.main,
format: "cjs", format: 'cjs',
sourcemap: true, sourcemap: true
}, },
{ {
file: packageJson.module, file: packageJson.module,
format: "esm", format: 'esm',
sourcemap: true, sourcemap: true
}, }
], ],
plugins: [ plugins: [
postcss({ postcss({
minimize: true, minimize: true,
extensions: ['.css'] extensions: ['.css'],
extract: true
}), }),
peerDepsExternal(), peerDepsExternal(),
nodeResolve({ nodeResolve({
extensions: ['.css'] extensions: ['.css']
}), }),
commonjs(), commonjs(),
typescript({ tsconfig: "./tsconfig.json" }), typescript({ tsconfig: './tsconfig.json' }),
terser() terser()
], ],
external: ["react", "react-dom", "index.css"] external: ['react', 'react-dom', 'index.css']
}, },
{ {
input: "dist/esm/index.d.ts", input: 'dist/esm/index.d.ts',
output: [{ file: "dist/index.d.ts", format: "esm" }], external: [/\.css$/],
plugins: [dts.default()], output: [{ file: 'dist/index.d.ts', format: 'esm' }],
plugins: [dts.default()]
} }
]; ];

View File

@ -1,6 +1,5 @@
import { DocExplorer } from './components/DocExplorer'; import { DocExplorer } from './components/DocExplorer';
// Todo: Rollup throws error
import './index.css'; import './index.css';
export { DocExplorer }; export { DocExplorer };