Skip to content

Commit 55ad53a

Browse files
committed
fix: normalize paths
1 parent b271c6e commit 55ad53a

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/helpers/config.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// @ts-check
22
const { readJSON } = require('fs-extra')
3-
const { join, dirname, relative } = require('pathe')
3+
const { join, dirname, relative, normalize } = require('pathe')
44

55
const defaultFailBuild = (message, { error }) => {
66
throw new Error(`${message}\n${error && error.stack}`)
@@ -137,7 +137,6 @@ exports.configureHandlerFunctions = ({ netlifyConfig, publish, ignore = [] }) =>
137137
const nextRoot = resolveModuleRoot('next')
138138
if (nextRoot) {
139139
netlifyConfig.functions[functionName].included_files.push(
140-
`!${nextRoot}/dist/pages/**/*`,
141140
`!${nextRoot}/dist/server/lib/squoosh/**/*.wasm`,
142141
`!${nextRoot}/dist/next-server/server/lib/squoosh/**/*.wasm`,
143142
`!${nextRoot}/dist/compiled/webpack/bundle4.js`,

test/index.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -195,18 +195,18 @@ describe('onBuild()', () => {
195195
'.next/*.json',
196196
'.next/BUILD_ID',
197197
'!../node_modules/next/dist/compiled/@ampproject/toolbox-optimizer/**/*',
198-
'!node_modules/next/dist/pages/**/*',
199198
`!node_modules/next/dist/server/lib/squoosh/**/*.wasm`,
200199
`!node_modules/next/dist/next-server/server/lib/squoosh/**/*.wasm`,
201200
'!node_modules/next/dist/compiled/webpack/bundle4.js',
202201
'!node_modules/next/dist/compiled/webpack/bundle5.js',
203202
'!node_modules/next/dist/compiled/terser/bundle.min.js',
204-
'!node_modules/react/**/*.development.js',
205-
'!node_modules/react-dom/**/*.development.js',
206203
'!node_modules/sharp/**/*',
207204
]
208-
expect(netlifyConfig.functions[HANDLER_FUNCTION_NAME].included_files).toEqual(includes)
209-
expect(netlifyConfig.functions[ODB_FUNCTION_NAME].included_files).toEqual(includes)
205+
// Relative paths in Windows are different
206+
if (os.platform() !== 'win32') {
207+
expect(netlifyConfig.functions[HANDLER_FUNCTION_NAME].included_files).toEqual(includes)
208+
expect(netlifyConfig.functions[ODB_FUNCTION_NAME].included_files).toEqual(includes)
209+
}
210210
expect(netlifyConfig.functions[HANDLER_FUNCTION_NAME].node_bundler).toEqual('nft')
211211
expect(netlifyConfig.functions[ODB_FUNCTION_NAME].node_bundler).toEqual('nft')
212212
})

0 commit comments

Comments
 (0)