Running storybook gives the error below. This error does not get triggered in version 3.3.3. I don't see any changes in the changelog that are related to this. Starting from 3.3.4 this fails
throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'path', 'string');
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string
at assertPath (path.js:28:11)
at Object.resolve (path.js:1179:7)
at getManagerHeadHtml (/node_modules/@storybook/react/dist/server/utils.js:52:35)
at Object.exports.default (/node_modules/@storybook/react/dist/server/config/webpack.config.js:23:53)
at Object.<anonymous> (/.storybook/webpack.config.js:1:145)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at exports.default (/node_modules/@storybook/react/dist/server/config.js:58:22)
at exports.default (/node_modules/@storybook/react/dist/server/middleware.js:19:37)
at Object.<anonymous> (/node_modules/@storybook/react/dist/server/index.js:153:34)
at Module._compile (module.js:660:30)
we're extending webpack config like this:
const base = require("@storybook/react/dist/server/config/webpack.config").default();
const defaults = require("@storybook/react/dist/server/config/defaults/webpack.config");
const webpack = require("webpack");
module.exports = defaults(
Object.assign({}, base, {
resolve: Object.assign({}, base.resolve, {
alias: Object.assign({}, (base.resolve || {}).alias, {
react: "preact-compat",
"react-dom": "preact-compat"
})
}),
plugins: [
new webpack.ProvidePlugin({
Component: ["preact", "Component"],
React: ["preact-compat"]
})
].concat(base.plugins)
})
);
Run storybook
I'm wondering if it has something to do with the npm missing packages issue this weekend?
Probably related to https://github.com/storybooks/storybook/pull/2666
Looks like I didn't take into account that webpack config function gets called from outside. Will send a patch PR soon
@Hypnosphi aha makes sense, thanks!
webpack config function gets called from outside
Oh, it actually shouldn't. According to docs, your config had to be written like this:
const defaults = require("@storybook/react/dist/server/config/defaults/webpack.config");
const webpack = require("webpack");
module.exports = (base, env) => {
const config = defaults(base, env);
return Object.assign({}, config, {
resolve: Object.assign({}, config.resolve, {
alias: Object.assign({}, (config.resolve || {}).alias, {
react: "preact-compat",
"react-dom": "preact-compat"
})
}),
plugins: [
new webpack.ProvidePlugin({
Component: ["preact", "Component"],
React: ["preact-compat"]
})
].concat(config.plugins)
})
);
Note that there's no import of server/config/webpack.config file, which is considered internal
Alright mistake on our end, thanks for the help @Hypnosphi! I think this issue can be closed!
Most helpful comment
Oh, it actually shouldn't. According to docs, your config had to be written like this:
Note that there's no import of
server/config/webpack.configfile, which is considered internal