2017-02-06 11:53:31 +03:00
|
|
|
const pkg = require('../package');
|
|
|
|
const path = require('path');
|
|
|
|
const webpack = require('webpack');
|
|
|
|
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
target: 'web',
|
|
|
|
context: path.join(__dirname, '../'),
|
|
|
|
devtool: 'cheap-module-eval-source-map',
|
|
|
|
entry: [
|
|
|
|
'webpack-hot-middleware/client',
|
2017-08-02 19:31:46 +03:00
|
|
|
'babel-polyfill',
|
2017-02-06 11:53:31 +03:00
|
|
|
'./spec/index.js'
|
|
|
|
],
|
|
|
|
output: {
|
|
|
|
path: path.join(__dirname, 'build'),
|
|
|
|
filename: 'spec.js',
|
|
|
|
publicPath: '/build/'
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
extensions: ['.js', '.css', '.json'],
|
|
|
|
modules: ['node_modules']
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [{
|
|
|
|
test: /\.js$/,
|
2017-05-23 13:07:41 +03:00
|
|
|
use: 'babel-loader',
|
2017-02-06 11:53:31 +03:00
|
|
|
include: [
|
|
|
|
path.join(__dirname, '../components'),
|
|
|
|
path.join(__dirname, '../spec')
|
|
|
|
]
|
|
|
|
}, {
|
|
|
|
test: /\.css$/,
|
|
|
|
include: /node_modules/,
|
2017-05-23 13:07:41 +03:00
|
|
|
use: ExtractTextPlugin.extract({
|
2017-02-06 11:53:31 +03:00
|
|
|
fallback: 'style-loader',
|
2017-05-25 10:27:58 +03:00
|
|
|
use: 'css-loader',
|
2017-02-06 11:53:31 +03:00
|
|
|
})
|
|
|
|
}, {
|
|
|
|
test: /\.css$/,
|
|
|
|
include: [
|
|
|
|
path.join(__dirname, '../components'),
|
|
|
|
path.join(__dirname, '../spec')
|
|
|
|
],
|
|
|
|
use: ['style-loader', {
|
|
|
|
loader: 'css-loader',
|
|
|
|
query: {
|
2017-05-23 13:07:41 +03:00
|
|
|
import: false,
|
|
|
|
importLoaders: 1,
|
2017-02-06 11:53:31 +03:00
|
|
|
localIdentName: '[name]__[local]___[hash:base64:5]',
|
2017-05-23 13:07:41 +03:00
|
|
|
modules: true,
|
2017-02-06 11:53:31 +03:00
|
|
|
sourceMap: true
|
|
|
|
},
|
2017-05-23 13:07:41 +03:00
|
|
|
}, {
|
|
|
|
loader: 'postcss-loader',
|
|
|
|
options: {
|
|
|
|
config: {
|
|
|
|
path: path.join(__dirname, './postcss.config.js')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}]
|
2017-02-06 11:53:31 +03:00
|
|
|
}]
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new ExtractTextPlugin({ filename: 'spec.css', allChunks: true }),
|
|
|
|
new webpack.HotModuleReplacementPlugin(),
|
|
|
|
new webpack.EvalSourceMapDevToolPlugin(),
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
'process.env.NODE_ENV': JSON.stringify('development'),
|
|
|
|
VERSION: JSON.stringify(pkg.version)
|
|
|
|
})
|
|
|
|
]
|
|
|
|
};
|