Skip to content

Commit

Permalink
fix: publicPath should be __webpack_public_path__ (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
popomore committed Mar 15, 2018
1 parent f9f703f commit 2ebef9d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/assets_context.js
Expand Up @@ -29,7 +29,7 @@ class Assets {

let script = '';
if (this.config.publicPath) {
script = `<script>window.__webpack__public_path__ = '${this.config.publicPath}';</script>`;
script = `<script>window.__webpack_public_path__ = '${this.config.publicPath}';</script>`;
}
script += scriptTpl({ url: this.getURL(entry) });
return script;
Expand Down
8 changes: 4 additions & 4 deletions test/assets.test.js
Expand Up @@ -30,7 +30,7 @@ describe('test/assets.test.js', () => {
.expect(/<link rel="stylesheet" href="http:\/\/127.0.0.1:8000\/index.css"><\/link>/)
.expect(/<script>window.context = {"data":1};<\/script>/)
.expect(/<script src="http:\/\/127.0.0.1:8000\/index.js"><\/script>/)
.expect(/<script>window.__webpack__public_path__ = '\/app\/public';<\/script>/)
.expect(/<script>window.__webpack_public_path__ = '\/app\/public';<\/script>/)
.expect(200);
});
});
Expand All @@ -54,7 +54,7 @@ describe('test/assets.test.js', () => {
.expect(/<link rel="stylesheet" href="http:\/\/cdn.com\/app\/public\/index.b8e2efea.css"><\/link>/)
.expect(/<script>window.context = {"data":1};<\/script>/)
.expect(/<script src="http:\/\/cdn.com\/app\/public\/index.c4ae6394.js"><\/script>/)
.expect(/<script>window.__webpack__public_path__ = '\/app\/public';<\/script>/)
.expect(/<script>window.__webpack_public_path__ = '\/app\/public';<\/script>/)
.expect(200);
});
});
Expand Down Expand Up @@ -166,7 +166,7 @@ describe('test/assets.test.js', () => {
.expect(/<link rel="stylesheet" href="http:\/\/127.0.0.1:8000\/index.css"><\/link>/)
.expect(/<script>window.context = {"data":1};<\/script>/)
.expect(/<script src="http:\/\/127.0.0.1:8000\/index.js"><\/script>/)
.expect(/<script>window.__webpack__public_path__ = '\/app\/public';<\/script>/)
.expect(/<script>window.__webpack_public_path__ = '\/app\/public';<\/script>/)
.expect(/<script>window.resourceBaseUrl = 'http:\/\/127.0.0.1:8000\/';<\/script/)
.expect(200);
});
Expand All @@ -188,7 +188,7 @@ describe('test/assets.test.js', () => {
.expect(/<link rel="stylesheet" href="http:\/\/cdn.com\/app\/public\/index.b8e2efea.css"><\/link>/)
.expect(/<script>window.context = {"data":1};<\/script>/)
.expect(/<script src="http:\/\/cdn.com\/app\/public\/index.c4ae6394.js"><\/script>/)
.expect(/<script>window.__webpack__public_path__ = '\/app\/public';<\/script>/)
.expect(/<script>window.__webpack_public_path__ = '\/app\/public';<\/script>/)
.expect(/<script>window.resourceBaseUrl = 'http:\/\/cdn.com\/app\/public\/';<\/script/)
.expect(200);
});
Expand Down

0 comments on commit 2ebef9d

Please sign in to comment.