Skip to content
This repository has been archived by the owner on Mar 17, 2021. It is now read-only.

Commit

Permalink
fix: remove = from default export (SyntaxError) (#178)
Browse files Browse the repository at this point in the history
  • Loading branch information
jungomi authored and michael-ciniawsky committed Jul 14, 2017
1 parent b47224a commit 3fe2d12
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export default function fileLoader(content) {
this.emitFile(outputPath, content);
}

return `export default = ${publicPath};`;
return `export default ${publicPath};`;
}

export const raw = true;
18 changes: 9 additions & 9 deletions test/correct-filename.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,34 +87,34 @@ describe('correct-filename', () => {
describe('publicPath option', () => {
it('should be supported', () => {
expect(run('/file.txt', 'publicPath=http://cdn/').result).toEqual(
'export default = "http://cdn/81dc9bdb52d04dc20036dbd8313ed055.txt";',
'export default "http://cdn/81dc9bdb52d04dc20036dbd8313ed055.txt";',
);
});
it('should override public path when given empty string', () => {
expect(run('/file.txt', 'publicPath=').result).toEqual(
'export default = "81dc9bdb52d04dc20036dbd8313ed055.txt";',
'export default "81dc9bdb52d04dc20036dbd8313ed055.txt";',
);
});
it('should use webpack public path when not set', () => {
expect(run('/file.txt').result).toEqual(
'export default = __webpack_public_path__ + "81dc9bdb52d04dc20036dbd8313ed055.txt";',
'export default __webpack_public_path__ + "81dc9bdb52d04dc20036dbd8313ed055.txt";',
);
});
});

describe('useRelativePath option', () => {
it('should be supported', () => {
expect(run('/this/is/the/context/file.txt', 'useRelativePath=true').result).toEqual(
'export default = __webpack_public_path__ + \"./81dc9bdb52d04dc20036dbd8313ed055.txt\";',
'export default __webpack_public_path__ + \"./81dc9bdb52d04dc20036dbd8313ed055.txt\";',
);
expect(run('/this/is/file.txt', 'useRelativePath=true').result).toEqual(
'export default = __webpack_public_path__ + \"../../81dc9bdb52d04dc20036dbd8313ed055.txt\";',
'export default __webpack_public_path__ + \"../../81dc9bdb52d04dc20036dbd8313ed055.txt\";',
);
expect(run('/this/file.txt', 'context=/this/is/the/&useRelativePath=true').result).toEqual(
'export default = __webpack_public_path__ + \"../../81dc9bdb52d04dc20036dbd8313ed055.txt\";',
'export default __webpack_public_path__ + \"../../81dc9bdb52d04dc20036dbd8313ed055.txt\";',
);
expect(run('/this/file.txt', 'context=/&useRelativePath=true').result).toEqual(
'export default = __webpack_public_path__ + \"this/81dc9bdb52d04dc20036dbd8313ed055.txt\";',
'export default __webpack_public_path__ + \"this/81dc9bdb52d04dc20036dbd8313ed055.txt\";',
);
});
});
Expand All @@ -125,7 +125,7 @@ describe('outputPath function', () => {
const options = {};
options.outputPath = outputFunc;
expect(runWithOptions('/this/is/the/context/file.txt', options).result).toEqual(
'export default = __webpack_public_path__ + \"/path/set/by/func\";',
'export default __webpack_public_path__ + \"/path/set/by/func\";',
);
});
it('should be ignored if you set useRelativePath', () => {
Expand All @@ -134,7 +134,7 @@ describe('outputPath function', () => {
options.outputPath = outputFunc;
options.useRelativePath = true;
expect(runWithOptions('/this/is/the/context/file.txt', options).result).toEqual(
'export default = __webpack_public_path__ + \"./81dc9bdb52d04dc20036dbd8313ed055.txt\";',
'export default __webpack_public_path__ + \"./81dc9bdb52d04dc20036dbd8313ed055.txt\";',
);
});
});

0 comments on commit 3fe2d12

Please sign in to comment.