Permalink
Browse files

fix: publicPath should be __webpack_public_path__ (#7)

  • Loading branch information...
popomore committed Mar 15, 2018
1 parent f9f703f commit 2ebef9d86235cc8c13dc262f1b767bdad77cea02
Showing with 5 additions and 5 deletions.
  1. +1 −1 lib/assets_context.js
  2. +4 −4 test/assets.test.js
@@ -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;
@@ -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);
});
});
@@ -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);
});
});
@@ -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);
});
@@ -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);
});

0 comments on commit 2ebef9d

Please sign in to comment.