File tree Expand file tree Collapse file tree 4 files changed +7
-293
lines changed
Expand file tree Collapse file tree 4 files changed +7
-293
lines changed Original file line number Diff line number Diff line change 6666 "@web/storybook-prebuilt" : " ^0.1.37" ,
6767 "@web/storybook-utils" : " ^1.0.0" ,
6868 "lit" : " ^2.7.5 || ^3.0.0" ,
69- "msw" : " 2.0.10 "
69+ "msw" : " ^ 2.0.11 "
7070 },
7171 "devDependencies" : {
7272 "@web/dev-server" : " ^0.4.0" ,
Original file line number Diff line number Diff line change 11// @ts -nocheck
22
33import fs from 'node:fs' ;
4- import { fileURLToPath } from 'node:url ' ;
4+ import { createRequire } from 'node:module ' ;
55import path from 'node:path' ;
66
7- const __dirname = fileURLToPath ( new URL ( '.' , import . meta. url ) ) ;
7+ const require = createRequire ( import . meta. url ) ;
88
99export function mockRollupPlugin (
1010 { interceptor } = {
@@ -14,7 +14,7 @@ export function mockRollupPlugin(
1414 return {
1515 name : 'rollup-plugin-msw' ,
1616 writeBundle ( opts ) {
17- const serviceWorkerPath = path . resolve ( __dirname , './sw .js') ;
17+ const serviceWorkerPath = require . resolve ( 'msw/mockServiceWorker .js') ;
1818 const sw = fs . readFileSync ( serviceWorkerPath , 'utf8' ) ;
1919 const outPath = path . join ( opts . dir , '__msw_sw__.js' ) ;
2020 fs . writeFileSync ( outPath , sw ) ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ import { createRequire } from 'node:module' ;
12import { readFileSync } from 'node:fs' ;
2- import { fileURLToPath } from 'node:url' ;
3- import path from 'node:path' ;
43
5- const __dirname = fileURLToPath ( new URL ( '.' , import . meta. url ) ) ;
4+ const require = createRequire ( import . meta. url ) ;
65
76export function mockPlugin ( ) {
87 return {
@@ -12,7 +11,7 @@ export function mockPlugin() {
1211 */
1312 serve ( context ) {
1413 if ( context . request . url === '/__msw_sw__.js' ) {
15- const serviceWorkerPath = path . resolve ( __dirname , './sw .js') ;
14+ const serviceWorkerPath = require . resolve ( 'msw/mockServiceWorker .js') ;
1615 return readFileSync ( serviceWorkerPath , 'utf8' ) ;
1716 }
1817 } ,
You can’t perform that action at this time.
0 commit comments