1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-12-27 09:28:19 +00:00
trezor-wallet/webpack/config.dev.babel.js

95 lines
2.5 KiB
JavaScript
Raw Normal View History

2018-05-17 20:08:34 +00:00
import webpack from 'webpack';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
2018-07-30 10:47:37 +00:00
import { SRC, BUILD, PORT } from './constants';
2018-05-17 20:08:34 +00:00
module.exports = {
watch: true,
mode: 'development',
devtool: 'inline-source-map',
entry: {
2018-08-10 15:18:22 +00:00
index: [`${SRC}js/index.js`],
2018-05-17 20:08:34 +00:00
},
output: {
filename: '[name].[hash].js',
path: BUILD,
},
devServer: {
contentBase: SRC,
hot: true,
https: false,
port: PORT,
stats: 'minimal',
inline: true,
},
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
2018-07-30 12:31:35 +00:00
use: ['babel-loader'],
2018-05-17 20:08:34 +00:00
},
{
test: /\.less$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
2018-07-30 10:47:37 +00:00
options: { publicPath: '../' },
},
2018-05-17 20:08:34 +00:00
'css-loader',
'less-loader',
2018-07-30 10:47:37 +00:00
],
2018-05-17 20:08:34 +00:00
},
{
test: /\.(png|gif|jpg)$/,
loader: 'file-loader?name=./images/[name].[ext]',
query: {
outputPath: './images',
name: '[name].[ext]',
2018-07-30 10:47:37 +00:00
},
2018-05-17 20:08:34 +00:00
},
{
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]',
2018-05-17 20:08:34 +00:00
},
},
2018-07-30 10:47:37 +00:00
],
2018-05-17 20:08:34 +00:00
},
resolve: {
modules: [SRC, 'node_modules'],
},
performance: {
2018-07-30 10:47:37 +00:00
hints: false,
2018-05-17 20:08:34 +00:00
},
plugins: [
new MiniCssExtractPlugin({
filename: '[name].css',
chunkFilename: '[id].css',
}),
2018-07-30 10:47:37 +00:00
2018-05-17 20:08:34 +00:00
new HtmlWebpackPlugin({
chunks: ['index'],
template: `${SRC}index.html`,
filename: 'index.html',
2018-07-30 10:47:37 +00:00
inject: true,
2018-05-17 20:08:34 +00:00
}),
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(),
2018-07-30 10:47:37 +00:00
],
};