We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
JSON.stringify
toJSString
1 parent 035ecf9 commit 5664e26Copy full SHA for 5664e26
.storybook/main.cjs
@@ -6,10 +6,6 @@ const readFile = (fileName) => util.promisify(fs.readFile)(fileName, 'utf8');
6
7
const path = require('path');
8
9
-// based on https://stackoverflow.com/a/22466191/2968864
10
-/** @param {string} str */
11
-const toJSString = (str) => "'" + str.replace(/[\\$'"`]/g, "\\$&").split(/\r\n|\n/).join('\\n') + "'";
12
-
13
module.exports = {
14
stories: ["../stories/**/*.stories.js"],
15
addons: [
@@ -33,7 +29,7 @@ module.exports = {
33
29
34
30
config.define = {
35
31
...(config.define || {}),
36
- __readme__: toJSString(await readFile('README.md'))
32
+ __readme__: JSON.stringify(await readFile('README.md'))
37
};
38
39
return config;
0 commit comments