1
- import { relative , sep , posix , resolve , dirname } from 'path' ;
1
+ import { relative , posix , resolve , dirname } from 'path' ;
2
2
import * as rollup from 'rollup' ;
3
3
import htmPlugin from './plugins/htm-plugin.js' ;
4
4
import sucrasePlugin from './plugins/sucrase-plugin.js' ;
5
5
import wmrPlugin from './plugins/wmr/plugin.js' ;
6
6
import wmrStylesPlugin from './plugins/wmr/styles-plugin.js' ;
7
+ import { normalizePath } from './utils.js' ;
7
8
import sassPlugin from './plugins/sass-plugin.js' ;
8
9
import terser from './plugins/fast-minify.js' ;
9
10
import npmPlugin from './plugins/npm-plugin/index.js' ;
@@ -24,9 +25,6 @@ import copyAssetsPlugin from './plugins/copy-assets-plugin.js';
24
25
import nodeBuiltinsPlugin from './plugins/node-builtins-plugin.js' ;
25
26
import dynamicImportVars from '@rollup/plugin-dynamic-import-vars' ;
26
27
27
- /** @param {string } p */
28
- const pathToPosix = p => p . split ( sep ) . join ( posix . sep ) ;
29
-
30
28
/** @typedef {import('rollup').OutputOptions } OutputOptions */
31
29
/** @typedef {OutputOptions | ((opts: OutputOptions) => OutputOptions) } Output */
32
30
@@ -84,7 +82,7 @@ export async function bundleProd({
84
82
await totalist ( cwd , ( rel , abs ) => {
85
83
if ( ignore . test ( abs ) ) return ;
86
84
if ( ! / \. h t m l ? / . test ( rel ) ) return ;
87
- input . push ( './' + pathToPosix ( relative ( root , abs ) ) ) ;
85
+ input . push ( './' + normalizePath ( relative ( root , abs ) ) ) ;
88
86
} ) ;
89
87
90
88
const bundle = await rollup . rollup ( {
@@ -150,7 +148,7 @@ export async function bundleProd({
150
148
plugins : [ minify && terser ( { compress : true , sourcemap } ) ] ,
151
149
sourcemap,
152
150
sourcemapPathTransform ( p , mapPath ) {
153
- let url = pathToPosix ( relative ( cwd , resolve ( dirname ( mapPath ) , p ) ) ) ;
151
+ let url = normalizePath ( relative ( cwd , resolve ( dirname ( mapPath ) , p ) ) ) ;
154
152
// strip leading relative path
155
153
url = url . replace ( / ^ \. \/ / g, '' ) ;
156
154
// replace internal npm prefix
0 commit comments