import { defineConfig } from "@flatjs/forge/define-config";
export default defineConfig({
output: {
format: "cjs",
},
plugin: {
pluginConfigs: {
babelOptions: {
usePreset: "react",
},
terserOptions: true,
},
},
});
Note:
- Can use
.mts
extension if your package.json without"type": "module"
- Can use
.ts
,.mts
extension if your package.json with"type": "module"
define scripts
in package.json
{ "forge": "flatjs-forge" }
- Using Npm scripts
yarn forge build --dts
yarn forge build --dts -f=esm
- Using npx
npx flatjs-forge build --dts
npx flatjs-forge build --dts -f=esm
- Show basic tips
-
yarn forge -h
-
yarn forge help
-
npx flatjs-forge -h
-
npx flatjs-forge help
- Show help info for command
build
-
yarn forge build -h
-
yarn forge help build
-
npx flatjs-forge build -h
-
npx flatjs-forge help build
Notes: if we must use --dts=false
instead using -d=false
to indicate dts:false
, The same usage goes for the other boolean types (-c=false
=> --compress=false
)
{ "baseUrl": "./src" }
We should not create folder name like rollup
in src/rollup
;
- while we use
import { moduleX } from rollup
; it will resolvemoduleX
fromsrc/rollup
instead import fromnode_modules
- while use
vitest
it may broken cause of wrongrollup
imported. - change
src/rollup
tosrc/create-rollup
is ok.