2020-06-23 21:49:46 +00:00
|
|
|
// License: LGPL-3.0-or-later
|
|
|
|
// Based on https://github.com/rails/webpacker/issues/1004#issuecomment-628377930
|
|
|
|
process.env.NODE_ENV = "development";
|
2020-09-23 18:38:44 +00:00
|
|
|
const railsWebpackEnv = require("../../config/webpack/environment");
|
2020-06-23 21:49:46 +00:00
|
|
|
|
2020-06-23 21:08:05 +00:00
|
|
|
module.exports = {
|
2020-09-24 16:55:07 +00:00
|
|
|
stories: [
|
|
|
|
"../../app/javascript/**/*!(--html).stories.mdx",
|
|
|
|
"../../app/javascript/**/*!(--html).stories.[tj]s?(x)"
|
|
|
|
],
|
|
|
|
addons: [
|
|
|
|
"@storybook/addon-links",
|
|
|
|
"@storybook/addon-essentials",
|
|
|
|
'storybook-addon-intl'
|
|
|
|
],
|
2020-07-15 17:50:14 +00:00
|
|
|
webpackFinal: (config) => {
|
|
|
|
const result = {
|
2020-06-23 21:08:05 +00:00
|
|
|
// do mutation to the config
|
2020-06-23 21:49:46 +00:00
|
|
|
...config,
|
|
|
|
resolve: {
|
|
|
|
...config.resolve,
|
|
|
|
...railsWebpackEnv.config.resolve,
|
|
|
|
modules: railsWebpackEnv.resolvedModules.map((i) => i.value),
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
...config.module,
|
|
|
|
rules: railsWebpackEnv.loaders
|
2020-07-15 17:50:14 +00:00
|
|
|
.filter((i) => !["nodeModules", //not sure why this is here
|
|
|
|
"moduleCss" // this addresses issues with our webpack config for css not matching what storybook wants
|
|
|
|
].includes(i.key) )
|
2020-06-23 21:49:46 +00:00
|
|
|
.map((i) => i.value),
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
...config.plugins,
|
|
|
|
...railsWebpackEnv.plugins.map((i) => i.value),
|
|
|
|
],
|
2020-07-15 17:50:14 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
result.module.rules.filter((i) => i.test.test('.ttf')).forEach((i) => {
|
|
|
|
i.use=['url-loader']
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
},
|
2020-06-23 21:08:05 +00:00
|
|
|
};
|