meteor-imports-webpack-plugin
meteor-imports-webpack-plugin copied to clipboard
add Storybook support
I am having a hard time trying to make this work with react-storybook.
Here is my .storybook/webpack.config.js:
const path = require('path');
const MeteorImportsPlugin = require('meteor-imports-webpack-plugin');
module.exports = function(storybookBaseConfig, configType) {
storybookBaseConfig.entry.manager.unshift(require.resolve('meteor-imports-webpack-plugin/meteor-imports'));
storybookBaseConfig.entry.preview.unshift(require.resolve('meteor-imports-webpack-plugin/meteor-imports'));
storybookBaseConfig.plugins.push(
new MeteorImportsPlugin({
ROOT_URL: 'http://localhost:3000/',
DDP_DEFAULT_CONNECTION_URL: 'http://localhost:3000/',
PUBLIC_SETTINGS: {},
meteorFolder: '.',
meteorEnv: { NODE_ENV: 'development' },
})
);
return storybookBaseConfig;
};
No matter what I do, I always get the following error:
=> Loading static files from: /myProject/.meteor/local/build/programs/web.browser/app .
=> Loading custom .babelrc
=> Loading custom webpack config (full-control mode).
React Storybook started on => http://localhost:9009/
/myProject/node_modules/enhanced-resolve/lib/Resolver.js:122
if(noError && !result) return callback();
^
TypeError: callback is not a function
at /myProject/node_modules/enhanced-resolve/lib/Resolver.js:122:33
at /myProject/node_modules/enhanced-resolve/lib/Resolver.js:191:15
at applyPluginsParallelBailResult.createInnerCallback.log (/myProject/node_modules/enhanced-resolve/lib/Resolver.js:110:4)
at loggingCallbackWrapper (/myProject/node_modules/enhanced-resolve/lib/createInnerCallback.js:21:19)
at Tapable.applyPluginsParallelBailResult (/myProject/node_modules/tapable/lib/Tapable.js:115:69)
at Tapable.<anonymous> (/myProject/node_modules/enhanced-resolve/lib/Resolver.js:103:8)
at Tapable.Resolver.forEachBail (/myProject/node_modules/enhanced-resolve/lib/Resolver.js:196:3)
at Tapable.doResolve (/myProject/node_modules/enhanced-resolve/lib/Resolver.js:102:7)
at Tapable.<anonymous> (/myProject/node_modules/meteor-imports-webpack-plugin/node_modules/enhanced-resolve/lib/ModulesInRootPlugin.js:23:12)
at Tapable.applyPluginsParallelBailResult (/myProject/node_modules/tapable/lib/Tapable.js:139:14)
Would it be possible for you to publish an example with a working storybook configured? :)
Ah shoot, I didn't realize it but when I published 2.0.0-beta.0 (which is for Webpack 2), it got marked as latest. While I fix that, try installing 1.1.0 and just do unshift('meteor-imports').
Okay, I fixed the latest tag on npm to point to 1.1.0.
@zvictor did you ever get it working with storybook? I'm running into webpack issues where it can't resolve meteor imports in my component files (i.e 'import { Meteor } from 'meteor/meteor''). I was hoping this plugin would fix that but I've been having issues, did you have any luck?