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

fix: remove = from default export (SyntaxError) #178

Merged
merged 1 commit into from
Jul 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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\";',
);
});
});