コード例 #1
0
ファイル: webpack.config.js プロジェクト: hating/emoji-mart
module.exports = (baseConfig, env) => {
  const config = genDefaultConfig(baseConfig, env);

  config.module.rules = [
    {
      test: /\.js$/,
      loader: 'babel-loader',
      include: [
        path.resolve(__dirname, '../stories'),
        path.resolve(__dirname, '../src'),
        path.resolve(__dirname, '../data'),
      ],
    },
    {
      test: /\.svg$/,
      loaders: ['babel-loader?presets[]=react', 'svg-jsx-loader?es6=true'],
      include: [
        path.resolve(__dirname, '../src/svgs'),
      ],
    },
    {
      test: /\.css$/,
      use: [ 'style-loader', 'css-loader' ],
      include: [
        path.resolve(__dirname, '../css'),
      ],
    },
  ];

  config.devtool.sourcemaps = {
    enabled: false,
  };

  return config;
};
コード例 #2
0
ファイル: webpack.config.js プロジェクト: harum/card-game
module.exports = (baseConfig, env) => {
  const defaultConfig = genDefaultConfig(baseConfig, env);

  // Extend defaultConfig as you need.
  defaultConfig.resolve.extensions.push('.js');
  defaultConfig.resolve.extensions.push('.css');
  defaultConfig.resolve.extensions.push('.scss');
  defaultConfig.resolve.extensions.push('.sass');

  defaultConfig.module.rules.push({
    test: /\.(sass|scss)$/,
    // loader: ['sass-loader'],
    use: ExtractTextPlugin.extract({
      fallback: 'style-loader',
      //resolve-url-loader may be chained before sass-loader if necessary
      use: ['css-loader', 'sass-loader']
    }),
    include: path.resolve(__dirname, '../')
  });

  defaultConfig.plugins.push(
    new ExtractTextPlugin('style.css')
  );

  return defaultConfig;
};
コード例 #3
0
module.exports = (baseConfig, env) => {
  const config = genDefaultConfig(baseConfig, env);
  config.module.rules.push({
    test: /\.(ts|tsx)$/,
    loader: require.resolve('awesome-typescript-loader')
  });
  // scss
  config.module.rules.push(webpackConfig.module.loaders[1]);
  config.resolve.extensions.push('.ts', '.tsx');

  config.resolve.modules = [srcPath, 'node_modules'];
  return config;
};
コード例 #4
0
module.exports = (baseConfig, env) => {
    const config = genDefaultConfig(baseConfig, env);

    // Extend it as you need.

    // For example, add typescript loader:
    config.module.rules.push({
        test: /\.(ts|tsx)$/,
        loader: require.resolve('awesome-typescript-loader')
    });
    config.resolve.extensions.push('.ts', '.tsx');

    return config;
};
コード例 #5
0
ファイル: storybook.config.js プロジェクト: voorash/condenser
module.exports = (baseConfig, env) => {
    const config = genDefaultConfig(baseConfig, env);
    config.resolve = {
        alias: {
            react: path.join(__dirname, '../node_modules', 'react'),
            assets: path.join(__dirname, '../src/app/assets')
        },
        extensions: ['.js', '.json', '.jsx'],
        modules: [
            path.resolve(__dirname, '../src'),
            'node_modules'
        ]
    };
    config.plugins.push( new ExtractTextPlugin('[name]-[chunkhash].css'));
    config.plugins.push(new webpack.DefinePlugin({
        'process.env': {
            BROWSER: JSON.stringify(true),
        }
    }));
    config.module = {
        rules: [
            {test: /\.(jpe?g|png)/, use: 'url-loader?limit=4096'},
            {test: /\.json$/, use: 'json-loader'},
            {test: /\.js$|\.jsx$/, exclude: /node_modules/, use: 'babel-loader'},
            {test: /\.svg$/, use: 'svg-inline-loader'},
            {
                test: require.resolve("blueimp-file-upload"),
                use: "imports?define=>false"
            },
            {
                test: /\.css$/,
                use: css_loaders
            },
            {
                test: /\.scss$/,
                use: ExtractTextPlugin.extract({
                    fallback: 'style-loader',
                    use: scss_loaders
                })
            },
            {
                test: /\.md/,
                use: 'raw-loader'
            }
        ]
    };
    return config;
};
コード例 #6
0
module.exports = (baseConfig, env) => {
    const config = genDefaultConfig(baseConfig, env);

    config.module.rules[3].exclude = /\.m\.svg$/;

    config.module.rules.push({
        test: /\.m\.less$/,
        use: [
            require.resolve('style-loader'),
            {
                loader: require.resolve('css-loader'),
                options: {
                    importLoaders: 1,
                    modules: true,
                    localIdentName: '[name]__[local]___[hash:base64:5]',
                    sourceMap: true
                },
            },
            require.resolve('less-loader')
        ]
    });

    config.module.rules.push({
        test: /\.less$/,
        exclude: /\.m\.less$/,
        use: [
            require.resolve('style-loader'),
            { loader: require.resolve('css-loader'), options: { sourceMap: true } },
            require.resolve('less-loader')
        ]
    });

    config.module.rules.push({
            test: /\.m\.svg$/,
            loader: require.resolve('svg-sprite-loader'),
            options: {
                symbolId: '[name]__[hash]'
            }
        });

    return config;
};
コード例 #7
0
ファイル: webpack.config.js プロジェクト: vonagam/reactoids
module.exports = function( baseConfig, env ) {

  let config = genDefaultConfig( baseConfig, env );

  config.plugins.push( new webpack.EnvironmentPlugin( [ 'REACTOIDS_PACKAGE' ] ) );


  let jsRule = config.module.rules[ 0 ];

  jsRule.query = require( '../babel/.babelrc.js' );

  delete jsRule.include;

  delete jsRule.exclude;

  jsRule.test = new RegExp( '^' + _.escapeRegExp( process.env.REACTOIDS_BASE ) + '/packages/[^/]+/sources' );


  return config;

};
コード例 #8
0
ファイル: webpack.config.js プロジェクト: i80and/docs-compass
module.exports = (baseConfig, env) => {
  const GLOBALS = {
    'process.env': {
      'NODE_ENV': JSON.stringify(env)
    },
    __DEV__: JSON.stringify(JSON.parse(process.env.DEBUG || (env === 'development' ? 'true' : 'false')))
  };

  const pluginWebpackConfig = (env === 'production')
    ? require('../config/webpack.prod.config.js')
    : require('../config/webpack.dev.config.js');

  const config = genDefaultConfig(baseConfig, env);

  // Extend default storybook webpack config with our own webpack configuration
  config.module.rules = pluginWebpackConfig.module.rules;
  config.resolve = pluginWebpackConfig.resolve;
  config.plugins = config.plugins.concat([
    new webpack.DefinePlugin(GLOBALS)
  ]);

  return config;
};