Skip to content

Commit 5664e26

Browse files
committed
use JSON.stringify instead of the custom made toJSString on storybook build instruction
1 parent 035ecf9 commit 5664e26

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

.storybook/main.cjs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ const readFile = (fileName) => util.promisify(fs.readFile)(fileName, 'utf8');
66

77
const path = require('path');
88

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-
139
module.exports = {
1410
stories: ["../stories/**/*.stories.js"],
1511
addons: [
@@ -33,7 +29,7 @@ module.exports = {
3329

3430
config.define = {
3531
...(config.define || {}),
36-
__readme__: toJSString(await readFile('README.md'))
32+
__readme__: JSON.stringify(await readFile('README.md'))
3733
};
3834

3935
return config;

0 commit comments

Comments
 (0)