Correct storybook's css and font loading
This commit is contained in:
parent
6ca0d1b9b6
commit
5609d26921
1 changed files with 16 additions and 4 deletions
|
@ -4,9 +4,10 @@ process.env.NODE_ENV = "development";
|
||||||
const railsWebpackEnv = require("../config/webpack/environment");
|
const railsWebpackEnv = require("../config/webpack/environment");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
stories: ["../app/javascript/stories/*.[tj]s?(x)"],
|
stories: ["../app/javascript/**/*.stories.[tj]s?(x)"],
|
||||||
addons: ['@storybook/addon-actions', '@storybook/addon-links', 'storybook-addon-intl'],
|
addons: ['@storybook/addon-actions', '@storybook/addon-links', 'storybook-addon-intl'],
|
||||||
webpackFinal: (config) => ({
|
webpackFinal: (config) => {
|
||||||
|
const result = {
|
||||||
// do mutation to the config
|
// do mutation to the config
|
||||||
...config,
|
...config,
|
||||||
resolve: {
|
resolve: {
|
||||||
|
@ -17,12 +18,23 @@ module.exports = {
|
||||||
module: {
|
module: {
|
||||||
...config.module,
|
...config.module,
|
||||||
rules: railsWebpackEnv.loaders
|
rules: railsWebpackEnv.loaders
|
||||||
.filter((i) => i.key !== "nodeModules")
|
.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) )
|
||||||
.map((i) => i.value),
|
.map((i) => i.value),
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
...config.plugins,
|
...config.plugins,
|
||||||
...railsWebpackEnv.plugins.map((i) => i.value),
|
...railsWebpackEnv.plugins.map((i) => i.value),
|
||||||
],
|
],
|
||||||
}),
|
|
||||||
|
};
|
||||||
|
|
||||||
|
result.module.rules.filter((i) => i.test.test('.ttf')).forEach((i) => {
|
||||||
|
i.use=['url-loader']
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
return result;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue