-
-
Save pi0/51bc07e21c81aa93b09c1b6950ffb402 to your computer and use it in GitHub Desktop.
Nuxt Storybook webpack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
const { getWebpackConfig } = require('nuxt') | |
module.exports = async ({ config, mode }) => { | |
const isDev = mode === 'development' | |
// Load webpack config for Nuxt | |
const nConfig = await getWebpackConfig('client', { | |
rootDir, | |
for: isDev ? 'dev' : 'build', | |
}) | |
// Chery-pick Nuxt plugins | |
const NPlugins = [ | |
'WebpackBarPlugin', | |
'DefinePlugin' // Provides process.env | |
] | |
config.plugins.push(...nConfig.plugins.filter(p => NPlugins.includes(p.constructor.name))) | |
config.plugins = config.plugins.filter(p => p.constructor.name !== 'ProgressPlugin') | |
// Aliases | |
config.resolve.alias = { | |
...nConfig.resolve.alias, | |
...config.resolve.alias, | |
} | |
// Return the altered config | |
return config; | |
}; |
pimlie
commented
Apr 20, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment