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

refactor: use ES Module export instead of CommonJS #69

Merged
merged 1 commit into from Mar 18, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/index.js
Expand Up @@ -12,5 +12,5 @@ export default function rawLoader(source) {
.replace(/\u2028/g, '\\u2028')
.replace(/\u2029/g, '\\u2029');

return `module.exports = ${json}`;
return `export default ${json}`;
}
6 changes: 3 additions & 3 deletions test/__snapshots__/loader.test.js.snap
Expand Up @@ -2,10 +2,10 @@

exports[`loader should works: errors 1`] = `Array []`;

exports[`loader should works: file 1`] = `"module.exports = \\"Где розы — там и тернии —\\\\nТаков закон судьбы.\\\\n\\\\nНиколай Алексеевич Некрасов\\\\n\\\\nWhere the roses are - there are thorns -\\\\nThat is the law of fate.\\\\n\\\\nNikolay Alekseevich Nekrasov\\\\n\\""`;
exports[`loader should works: file 1`] = `"export default \\"Где розы — там и тернии —\\\\nТаков закон судьбы.\\\\n\\\\nНиколай Алексеевич Некрасов\\\\n\\\\nWhere the roses are - there are thorns -\\\\nThat is the law of fate.\\\\n\\\\nNikolay Alekseevich Nekrasov\\\\n\\""`;

exports[`loader should works: inline 1`] = `"module.exports = \\"Где розы — там и тернии —\\\\nТаков закон судьбы.\\\\n\\\\nНиколай Алексеевич Некрасов\\\\n\\\\nWhere the roses are - there are thorns -\\\\nThat is the law of fate.\\\\n\\\\nNikolay Alekseevich Nekrasov\\\\n\\""`;
exports[`loader should works: inline 1`] = `"export default \\"Где розы — там и тернии —\\\\nТаков закон судьбы.\\\\n\\\\nНиколай Алексеевич Некрасов\\\\n\\\\nWhere the roses are - there are thorns -\\\\nThat is the law of fate.\\\\n\\\\nNikolay Alekseevich Nekrasov\\\\n\\""`;

exports[`loader should works: separator 1`] = `"module.exports = \\"Word\\\\u2028Word\\\\u2029Word\\\\n\\""`;
exports[`loader should works: separator 1`] = `"export default \\"Word\\\\u2028Word\\\\u2029Word\\\\n\\""`;

exports[`loader should works: warnings 1`] = `Array []`;