@@ -2,9 +2,10 @@ const { rm } = require('fs/promises')
22const { join } = require ( 'path' )
33
44const ensureNoCompetingPlugin = require ( './helpers/ensureNoCompetingPlugin' )
5+ const fixOutputDir = require ( './helpers/fixOutputDir' )
56const getAngularJson = require ( './helpers/getAngularJson' )
67const getAngularRoot = require ( './helpers/getAngularRoot' )
7- const setUpEdgeFunction = require ( './helpers/setUpEdgeFunction' )
8+ const { setUpEdgeFunction } = require ( './helpers/setUpEdgeFunction' )
89const validateAngularVersion = require ( './helpers/validateAngularVersion' )
910
1011let isValidAngularProject = true
@@ -17,7 +18,7 @@ module.exports = {
1718 const edgeFunctionDir = join ( constants . INTERNAL_EDGE_FUNCTIONS_SRC , 'angular-ssr' )
1819 await rm ( edgeFunctionDir , { recursive : true } )
1920 } ,
20- async onPreBuild ( { netlifyConfig, utils } ) {
21+ async onPreBuild ( { netlifyConfig, utils, constants } ) {
2122 const siteRoot = getAngularRoot ( { netlifyConfig } )
2223 isValidAngularProject = await validateAngularVersion ( siteRoot )
2324 if ( ! isValidAngularProject ) {
@@ -28,6 +29,14 @@ module.exports = {
2829 ensureNoCompetingPlugin ( siteRoot , utils . build . failBuild )
2930
3031 netlifyConfig . build . command ??= 'npm run build'
32+
33+ await fixOutputDir ( {
34+ siteRoot,
35+ failBuild : utils . build . failBuild ,
36+ PUBLISH_DIR : constants . PUBLISH_DIR ,
37+ IS_LOCAL : constants . IS_LOCAL ,
38+ netlifyConfig,
39+ } )
3140 } ,
3241 async onBuild ( { utils, netlifyConfig, constants } ) {
3342 if ( ! isValidAngularProject ) {
@@ -39,11 +48,8 @@ module.exports = {
3948 const siteRoot = getAngularRoot ( { netlifyConfig } )
4049 const angularJson = getAngularJson ( { failBuild, siteRoot } )
4150
42- const projectName = angularJson . defaultProject ?? Object . keys ( angularJson . projects ) [ 0 ]
43-
4451 await setUpEdgeFunction ( {
4552 angularJson,
46- projectName,
4753 constants,
4854 netlifyConfig,
4955 failBuild,
0 commit comments