Skip to content

Commit 650513e

Browse files
authored
Merge pull request #24 from windsonR/master
use config.base to replace '/'
2 parents 4050df1 + 698d2a4 commit 650513e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export default function monacoEditorPlugin(options: IMonacoEditorOpts = {}): Plu
8484
},
8585
transformIndexHtml(html) {
8686
const works = getWorks(options);
87-
const workerPaths = getWorkPath(works, options);
87+
const workerPaths = getWorkPath(works, options, resolvedConfig);
8888

8989
const globals = {
9090
MonacoEnvironment: `(function (paths) {

src/workerMiddleware.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ export function getFilenameByEntry(entry: string) {
1212

1313
export const cacheDir = 'node_modules/.monaco/';
1414

15-
export function getWorkPath(works: IWorkerDefinition[], options: IMonacoEditorOpts) {
15+
export function getWorkPath(works: IWorkerDefinition[], options: IMonacoEditorOpts, config: ResolvedConfig) {
1616
const workerPaths = {};
1717

1818
for (const work of works) {
1919
if (isCDN(options.publicPath)) {
2020
workerPaths[work.label] = options.publicPath + '/' + getFilenameByEntry(work.entry);
2121
} else {
22-
workerPaths[work.label] = '/' + options.publicPath + '/' + getFilenameByEntry(work.entry);
22+
workerPaths[work.label] = config.base + options.publicPath + '/' + getFilenameByEntry(work.entry);
2323
}
2424
}
2525

0 commit comments

Comments
 (0)