From 64019f8ecf5378087050cda15a55edefaec2798a Mon Sep 17 00:00:00 2001 From: Anik Das Date: Sat, 30 Sep 2023 09:49:02 +0530 Subject: [PATCH] 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 --- docs/development.md | 4 +- packages/bruno-graphql-docs/rollup.config.js | 42 ++++++++++---------- packages/bruno-graphql-docs/src/index.ts | 1 - 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/docs/development.md b/docs/development.md index 21bf0cbab..77614d2f6 100644 --- a/docs/development.md +++ b/docs/development.md @@ -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. ### Dependencies -* NodeJS v18 + +- NodeJS v18 ### Local Development @@ -15,7 +16,6 @@ nvm use npm i --legacy-peer-deps # build graphql docs -# note: you can for now ignore the error thrown while building the graphql docs npm run build:graphql-docs # build bruno query diff --git a/packages/bruno-graphql-docs/rollup.config.js b/packages/bruno-graphql-docs/rollup.config.js index dd2424c5f..d289e1df1 100644 --- a/packages/bruno-graphql-docs/rollup.config.js +++ b/packages/bruno-graphql-docs/rollup.config.js @@ -1,46 +1,48 @@ -const { nodeResolve } = require("@rollup/plugin-node-resolve"); -const commonjs = require("@rollup/plugin-commonjs"); -const typescript = require("@rollup/plugin-typescript"); -const dts = require("rollup-plugin-dts"); -const postcss = require("rollup-plugin-postcss"); -const { terser } = require("rollup-plugin-terser"); +const { nodeResolve } = require('@rollup/plugin-node-resolve'); +const commonjs = require('@rollup/plugin-commonjs'); +const typescript = require('@rollup/plugin-typescript'); +const dts = require('rollup-plugin-dts'); +const postcss = require('rollup-plugin-postcss'); +const { terser } = require('rollup-plugin-terser'); const peerDepsExternal = require('rollup-plugin-peer-deps-external'); -const packageJson = require("./package.json"); +const packageJson = require('./package.json'); module.exports = [ { - input: "src/index.ts", + input: 'src/index.ts', output: [ { file: packageJson.main, - format: "cjs", - sourcemap: true, + format: 'cjs', + sourcemap: true }, { file: packageJson.module, - format: "esm", - sourcemap: true, - }, + format: 'esm', + sourcemap: true + } ], plugins: [ postcss({ minimize: true, - extensions: ['.css'] + extensions: ['.css'], + extract: true }), peerDepsExternal(), nodeResolve({ extensions: ['.css'] }), commonjs(), - typescript({ tsconfig: "./tsconfig.json" }), + typescript({ tsconfig: './tsconfig.json' }), terser() ], - external: ["react", "react-dom", "index.css"] + external: ['react', 'react-dom', 'index.css'] }, { - input: "dist/esm/index.d.ts", - output: [{ file: "dist/index.d.ts", format: "esm" }], - plugins: [dts.default()], + input: 'dist/esm/index.d.ts', + external: [/\.css$/], + output: [{ file: 'dist/index.d.ts', format: 'esm' }], + plugins: [dts.default()] } -]; \ No newline at end of file +]; diff --git a/packages/bruno-graphql-docs/src/index.ts b/packages/bruno-graphql-docs/src/index.ts index e38befd3c..b8c6cd039 100644 --- a/packages/bruno-graphql-docs/src/index.ts +++ b/packages/bruno-graphql-docs/src/index.ts @@ -1,6 +1,5 @@ import { DocExplorer } from './components/DocExplorer'; -// Todo: Rollup throws error import './index.css'; export { DocExplorer };