-
-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support ast merge sourcemap generation
- Loading branch information
Showing
22 changed files
with
960 additions
and
637 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,47 @@ | ||
import { builtinModules } from 'module'; | ||
import { builtinModules } from "module"; | ||
|
||
const format = process.env.FARM_FORMAT || 'cjs'; | ||
const ext = format === 'esm' ? 'mjs' : 'cjs'; | ||
const format = process.env.FARM_FORMAT || "cjs"; | ||
const ext = format === "esm" ? "mjs" : "cjs"; | ||
|
||
export function createFarmJsPluginBuildConfig(plugins, options = {}) { | ||
return { | ||
compilation: { | ||
input: { | ||
index: './src/index.ts' | ||
index: "./src/index.ts", | ||
}, | ||
output: { | ||
path: `build/${format}`, | ||
entryFilename: `[entryName].${ext}`, | ||
targetEnv: 'node', | ||
format | ||
targetEnv: "node", | ||
format, | ||
}, | ||
external: [ | ||
'@farmfe/core', | ||
"@farmfe/core", | ||
...builtinModules.map((m) => `^${m}$`), | ||
...builtinModules.map((m) => `^node:${m}$`), | ||
...(options.external || []) | ||
...(options.external || []), | ||
], | ||
partialBundling: { | ||
enforceResources: [ | ||
{ | ||
name: 'index.js', | ||
test: ['.+'] | ||
} | ||
] | ||
name: "index.js", | ||
test: [".+"], | ||
}, | ||
], | ||
}, | ||
minify: false, | ||
sourcemap: false, | ||
presetEnv: false, | ||
persistentCache: { | ||
envs: { | ||
FARM_FORMAT: format | ||
} | ||
} | ||
persistentCache: false, | ||
// persistentCache: { | ||
// envs: { | ||
// FARM_FORMAT: format | ||
// } | ||
// } | ||
}, | ||
server: { | ||
hmr: false | ||
hmr: false, | ||
}, | ||
plugins | ||
plugins, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.