How to use the @rails/webpacker/package/config.source_path function in @rails/webpacker

To help you get started, we’ve selected a few @rails/webpacker examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tai2 / webpacker-react-example / .storybook / webpack.config.js View on Github external
module.exports = (storybookBaseConfig, configType) => {
  // Here reusing webpacker's style rules. It needs setting hmr config true in
  // webpacker.yml. Otherwise ExtractTextPlugin will be used and result in runtime
  // errors in storybook.
  const rules = [
    environment.loaders.get('css'),
    environment.loaders.get('sass'),
    environment.loaders.get('moduleCss'),
    environment.loaders.get('moduleSass'),
    environment.loaders.get('typescript'),
    environment.loaders.get('file'),
  ]
  storybookBaseConfig.module.rules.push(...rules)
  storybookBaseConfig.resolve.extensions.push('.ts', '.tsx', 'scss');
  storybookBaseConfig.resolve.modules.unshift(resolve(config.source_path))
  return storybookBaseConfig
}