Skip to content

Instantly share code, notes, and snippets.

@yutahaga
Created May 11, 2018 20:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yutahaga/1a7f37491a6177d3a924fb2d024de905 to your computer and use it in GitHub Desktop.
Save yutahaga/1a7f37491a6177d3a924fb2d024de905 to your computer and use it in GitHub Desktop.
TypeScipt + @storybook/vue + @vue/cli 構成用の Webpack 設定ファイル。@vue/cli@3.0.0-beta.10 + webpack@4.8.2 + vue-loader@15.0.10 でビルド確認済み。
const merge = require('webpack-merge');
const vueConfig = require('@vue/cli-service/webpack.config.js');
module.exports = (storybookConfig, configType) => {
return {
...vueConfig, // use vue's webpack configuration by default
entry: storybookConfig.entry, // overwite entry
output: storybookConfig.output, // overwrite output
// remove duplicated plugins
plugins: merge({
customizeArray: merge.unique(
'plugins',
['HotModuleReplacementPlugin', 'CaseSensitivePathsPlugin', 'WatchMissingNodeModulesPlugin'],
plugin => plugin.constructor && plugin.constructor.name,
),
})(vueConfig, storybookConfig).plugins,
resolve: {
// <--------- This bit here
...vueConfig.resolve,
alias: {
...vueConfig.resolve.alias,
vue$: storybookConfig.resolve.alias.vue$,
},
},
};
};
@yutahaga
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment