Skip to content

Commit 7c379c0

Browse files
committed
Only use POSIX when using glob
1 parent c91ec8f commit 7c379c0

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/scripts/build/rollup.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const {
88
hasFile,
99
resolveBin,
1010
fromRoot,
11+
toPOSIX,
1112
getConcurrentlyArgs,
1213
writeExtraEntry,
1314
hasTypescript,
@@ -76,8 +77,8 @@ function go() {
7677
writeExtraEntry(
7778
'preact',
7879
{
79-
cjs: glob.sync(fromRoot('preact/**/*.cjs.js'))[0],
80-
esm: glob.sync(fromRoot('preact/**/*.esm.js'))[0],
80+
cjs: glob.sync(toPOSIX(fromRoot('preact/**/*.cjs.js')))[0],
81+
esm: glob.sync(toPOSIX(fromRoot('preact/**/*.esm.js')))[0],
8182
},
8283
false,
8384
)
@@ -101,7 +102,7 @@ function go() {
101102
const isCodesplitting = rollupInputs.length > 1
102103

103104
const outputs = isCodesplitting
104-
? glob.sync(fromRoot(path.posix.join(dirpath, format, '*.js')))
105+
? glob.sync(toPOSIX(fromRoot(path.posix.join(dirpath, format, '*.js'))))
105106
: [fromRoot(path.join(dirpath, filename))]
106107

107108
for (const output of outputs) {
@@ -123,8 +124,8 @@ function go() {
123124
// because typescript generates type defs for ignored files, we need to
124125
// remove the ignored files
125126
const ignoredFiles = [
126-
...glob.sync(fromRoot('dist', '**/__tests__/**')),
127-
...glob.sync(fromRoot('dist', '**/__mocks__/**')),
127+
...glob.sync(toPOSIX(fromRoot('dist', '**/__tests__/**'))),
128+
...glob.sync(toPOSIX(fromRoot('dist', '**/__mocks__/**'))),
128129
]
129130
ignoredFiles.forEach(ignoredFile => {
130131
rimraf.sync(ignoredFile)

src/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function resolveBin(modName, {executable = modName, cwd = process.cwd()} = {}) {
5454
}
5555
}
5656

57-
const fromRoot = (...p) => path.posix.join(appDirectory, ...p)
57+
const fromRoot = (...p) => path.join(appDirectory, ...p)
5858
const toPOSIX = p => p.split(path.sep).join(path.posix.sep)
5959
const hasFile = (...p) => fs.existsSync(fromRoot(...p))
6060
const ifFile = (files, t, f) =>
@@ -193,7 +193,7 @@ function getRollupInputs() {
193193
const buildInputGlob =
194194
process.env.BUILD_INPUT ||
195195
(hasTypescript ? 'src/index.{js,ts,tsx}' : 'src/index.js')
196-
const input = glob.sync(fromRoot(buildInputGlob))
196+
const input = glob.sync(toPOSIX(fromRoot(buildInputGlob)))
197197
if (!input.length) {
198198
throw new Error(`Unable to find files with this glob: ${buildInputGlob}`)
199199
}

0 commit comments

Comments
 (0)