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

Commit 3c7bf2c

Browse files
niksyevilebottnawi
authored andcommittedMar 18, 2019
feat: use ES Module export instead of CommonJS (#69)
1 parent 7fa759c commit 3c7bf2c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed
 

‎src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ export default function rawLoader(source) {
1212
.replace(/\u2028/g, '\\u2028')
1313
.replace(/\u2029/g, '\\u2029');
1414

15-
return `module.exports = ${json}`;
15+
return `export default ${json}`;
1616
}

‎test/__snapshots__/loader.test.js.snap

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

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

5-
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\\""`;
5+
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\\""`;
66

7-
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\\""`;
7+
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\\""`;
88

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

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

0 commit comments

Comments
 (0)
This repository has been archived.