暫無描述

webpack.config.js 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. module.exports = (baseConfig, env, defaultConfig) => {
  2. const config = {...defaultConfig, ...baseConfig};
  3. config.module.rules.push({
  4. test: /\.(ts|tsx)$/,
  5. loader: require.resolve('awesome-typescript-loader')
  6. });
  7. config.module.rules.push({
  8. test: /Story.tsx/,
  9. loaders: [
  10. {
  11. loader: require.resolve('@storybook/addon-storysource/loader'),
  12. options: {parser: 'typescript'}
  13. }
  14. ],
  15. enforce: 'pre',
  16. });
  17. config.module.rules.push({
  18. test: /\.css/, use: [
  19. {
  20. loader: 'style-loader'
  21. },
  22. {
  23. loader: 'css-loader', options: {sourceMap: true}
  24. }]
  25. });
  26. config.module.rules.push({
  27. test: /\.scss$/, use: [
  28. {
  29. loader: 'style-loader'
  30. },
  31. {
  32. loader: 'css-loader', options: {sourceMap: true}
  33. },
  34. {
  35. loader: 'sass-loader', options: {sourceMap: true}
  36. }]
  37. });
  38. config.resolve.extensions.push('.ts', '.tsx');
  39. return config;
  40. };