1- import { relative , sep , posix , resolve , dirname } from 'path' ;
1+ import { relative , posix , resolve , dirname } from 'path' ;
22import * as rollup from 'rollup' ;
33import htmPlugin from './plugins/htm-plugin.js' ;
44import sucrasePlugin from './plugins/sucrase-plugin.js' ;
55import wmrPlugin from './plugins/wmr/plugin.js' ;
66import wmrStylesPlugin from './plugins/wmr/styles-plugin.js' ;
7+ import { normalizePath } from './utils.js' ;
78import sassPlugin from './plugins/sass-plugin.js' ;
89import terser from './plugins/fast-minify.js' ;
910import npmPlugin from './plugins/npm-plugin/index.js' ;
@@ -24,9 +25,6 @@ import copyAssetsPlugin from './plugins/copy-assets-plugin.js';
2425import nodeBuiltinsPlugin from './plugins/node-builtins-plugin.js' ;
2526import dynamicImportVars from '@rollup/plugin-dynamic-import-vars' ;
2627
27- /** @param {string } p */
28- const pathToPosix = p => p . split ( sep ) . join ( posix . sep ) ;
29-
3028/** @typedef {import('rollup').OutputOptions } OutputOptions */
3129/** @typedef {OutputOptions | ((opts: OutputOptions) => OutputOptions) } Output */
3230
@@ -84,7 +82,7 @@ export async function bundleProd({
8482 await totalist ( cwd , ( rel , abs ) => {
8583 if ( ignore . test ( abs ) ) return ;
8684 if ( ! / \. h t m l ? / . test ( rel ) ) return ;
87- input . push ( './' + pathToPosix ( relative ( root , abs ) ) ) ;
85+ input . push ( './' + normalizePath ( relative ( root , abs ) ) ) ;
8886 } ) ;
8987
9088 const bundle = await rollup . rollup ( {
@@ -150,7 +148,7 @@ export async function bundleProd({
150148 plugins : [ minify && terser ( { compress : true , sourcemap } ) ] ,
151149 sourcemap,
152150 sourcemapPathTransform ( p , mapPath ) {
153- let url = pathToPosix ( relative ( cwd , resolve ( dirname ( mapPath ) , p ) ) ) ;
151+ let url = normalizePath ( relative ( cwd , resolve ( dirname ( mapPath ) , p ) ) ) ;
154152 // strip leading relative path
155153 url = url . replace ( / ^ \. \/ / g, '' ) ;
156154 // replace internal npm prefix
0 commit comments