Skip to content

Commit

Permalink
fix(RawAsset): fix incorrect bundle path (#389)
Browse files Browse the repository at this point in the history
  • Loading branch information
Raincal authored and devongovett committed Dec 23, 2017
1 parent 0f40da9 commit 38f8aaf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
6 changes: 5 additions & 1 deletion src/assets/RawAsset.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ class RawAsset extends Asset {
load() {}

generate() {
let publicURL = this.options.publicURL;
publicURL = /\/$/.test(publicURL) ? publicURL : `${publicURL}/`;

const pathToAsset = JSON.stringify(
url.resolve(this.options.publicURL, this.generateBundleName())
url.resolve(publicURL, this.generateBundleName())
);

return {
js: `module.exports=${pathToAsset};`
};
Expand Down
4 changes: 2 additions & 2 deletions test/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ describe('javascript', function() {

let output = run(b);
assert.equal(typeof output, 'function');
assert(/^\/[0-9a-f]+\.txt$/.test(output()));
assert(fs.existsSync(__dirname + '/dist/' + output()));
assert(/^\/dist\/[0-9a-f]+\.txt$/.test(output()));
assert(fs.existsSync(__dirname + output()));
});

it('should minify JS in production mode', async function() {
Expand Down
4 changes: 2 additions & 2 deletions test/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ describe('typescript', function() {

let output = run(b);
assert.equal(typeof output.getRaw, 'function');
assert(/^\/[0-9a-f]+\.txt$/.test(output.getRaw()));
assert(fs.existsSync(__dirname + '/dist/' + output.getRaw()));
assert(/^\/dist\/[0-9a-f]+\.txt$/.test(output.getRaw()));
assert(fs.existsSync(__dirname + output.getRaw()));
});

it('should minify in production mode', async function() {
Expand Down

0 comments on commit 38f8aaf

Please sign in to comment.