I worked with rc-tree which is using father package for creating storybook and i'v got this error when i ran npm start:
Cannot find module 'C:UsersHamedDocumentsProjects ree ERR! ode_modules atherlibdocstorybook-webpack'
rc-tree package.json:
"scripts": { "start": "cross-env NODE_ENV=development father doc dev --storybook", "build": "father doc build --storybook", "compile": "father build", "prepublishOnly": "npm run compile && np --no-cleanup --yolo --no-publish", "lint": "eslint src/ examples/ --ext .tsx,.ts,.jsx,.js", "test": "father test", "now-build": "npm run build" },
there seems to be a problem in storybook generator :
module.exports = function(...args) {
return require('${join(__dirname, 'storybook-webpack')}')(...args);
};
and
const configJs = function loadStories() { require('${entryPath}'); }
that generate webpack.config in .storybook directory like this:
module.exports = function(...args) { return require('C:\Users\Hamed\Documents\Projects\tree\node_modules\father\lib\doc\storybook-webpack')(...args); };
and when this file runs i have got above error .
I think __dirname and path.join in windows return path with back slash "\" that must be replace with forward slash "/" to work properly with require. I have tested it and it works fine with str replace or slash package.