You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
trezor-wallet/webpack/dev.babel.js

103 lines
2.6 KiB

6 years ago
import webpack from 'webpack';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import {
SRC, BUILD, PORT, PUBLIC,
} from './constants';
6 years ago
module.exports = {
watch: true,
mode: 'development',
devtool: 'inline-source-map',
entry: {
index: [`${SRC}/index.js`],
6 years ago
},
output: {
filename: '[name].[hash].js',
path: BUILD,
},
devServer: {
contentBase: [
SRC,
PUBLIC,
],
6 years ago
hot: true,
https: false,
port: PORT,
stats: 'minimal',
inline: true,
},
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: ['babel-loader'],
6 years ago
},
{
test: /\.less$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
6 years ago
options: { publicPath: '../' },
},
6 years ago
'css-loader',
'less-loader',
6 years ago
],
6 years ago
},
{
test: /\.(png|gif|jpg)$/,
loader: 'file-loader?name=./images/[name].[ext]',
query: {
outputPath: './images',
name: '[name].[ext]',
6 years ago
},
6 years ago
},
{
test: /\.(ttf|eot|svg|woff|woff2)$/,
loader: 'file-loader',
query: {
outputPath: './fonts',
name: '[name].[ext]',
},
},
{
type: 'javascript/auto',
test: /\.json/,
exclude: /(node_modules)/,
loader: 'file-loader',
query: {
outputPath: './data',
name: '[name].[ext]',
6 years ago
},
},
6 years ago
],
6 years ago
},
resolve: {
alias: {
public: PUBLIC,
},
6 years ago
modules: [SRC, 'node_modules'],
},
performance: {
6 years ago
hints: false,
6 years ago
},
plugins: [
new MiniCssExtractPlugin({
filename: '[name].css',
chunkFilename: '[id].css',
}),
6 years ago
6 years ago
new HtmlWebpackPlugin({
chunks: ['index'],
template: `${SRC}index.html`,
filename: 'index.html',
6 years ago
inject: true,
6 years ago
}),
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(),
6 years ago
],
};