Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import path from 'path'
  2. import webpack from 'webpack'
  3. import nested from 'jss-nested'
  4. import camelCase from 'jss-camel-case'
  5. import autoprefixer from 'autoprefixer'
  6. import HtmlWebpackPlugin from 'html-webpack-plugin'
  7. import CssResolvePlugin from 'elementum-tools/lib/webpack/css-resolve-plugin'
  8.  
  9. export const entry = [
  10.   'babel-polyfill',
  11.   'webpack-hot-middleware/client',
  12.   'react-hot-loader/patch',
  13.   './src/index.js',
  14. ]
  15.  
  16. export const output = {
  17.   path: '/',
  18.   filename: '/[name].js',
  19. }
  20.  
  21. export const devtool = 'eval'
  22.  
  23. export const module = {
  24.   rules: [
  25.     {
  26.       test: /\.js?$/,
  27.       loader: 'babel-loader',
  28.       exclude: /node_modules\/(?!ki-ui)/,
  29.       options: {
  30.         babelrc: false,
  31.         presets: [
  32.           'es2015',
  33.           'stage-0',
  34.           'react',
  35.         ],
  36.         plugins: [
  37.           ['elementum-tools/lib/babel/plugin', {
  38.             alias: {
  39.               KI: 'src',
  40.               KIUI: 'node_modules/ki-ui/src',
  41.             },
  42.             extract: true,
  43.           }],
  44.           'react-hot-loader/babel',
  45.           'transform-runtime',
  46.         ],
  47.       },
  48.     },
  49.     {
  50.       test: /\.css$/,
  51.       use: [
  52.         'style-loader',
  53.         'css-loader',
  54.         'postcss-loader',
  55.       ],
  56.     },
  57.     {
  58.       test: /\.jss$/,
  59.       use: [
  60.         'style-loader',
  61.         'css-loader',
  62.         'postcss-loader',
  63.         'jss-loader',
  64.       ],
  65.     },
  66.     {
  67.       test: /\.styl$/,
  68.       include: path.join(__dirname, '..', '..', 'src'),
  69.       loaders: [
  70.         'style-loader',
  71.         'css-loader',
  72.         'stylus-loader',
  73.       ],
  74.     },
  75.     {
  76.       test: /\.(png|jpg|svg|ttf|eot|woff|woff2)$/,
  77.       loader: 'file?name=[name].[ext]',
  78.     },
  79.   ],
  80. }
  81.  
  82. export const plugins = [
  83.   new CssResolvePlugin(),
  84.   new webpack.HotModuleReplacementPlugin(),
  85.   new HtmlWebpackPlugin({
  86.     filename: 'index.html',
  87.     template: path.resolve(__dirname, 'index.ejs'),
  88.   }),
  89.   new webpack.ProvidePlugin({
  90.     fetch: 'imports?this=>global!exports?global.fetch!whatwg-fetch',
  91.   }),
  92.   new webpack.LoaderOptionsPlugin({
  93.     options: {
  94.       jssLoader: {
  95.         plugins: [
  96.           nested(),
  97.           camelCase(),
  98.         ],
  99.       },
  100.       postcss: {
  101.         plugins: autoprefixer({
  102.           browsers: [
  103.             '>2%',
  104.             'last 2 versions',
  105.           ],
  106.         }),
  107.       },
  108.     },
  109.   }),
  110. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement