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

126 lines
3.7 KiB

6 years ago
import webpack from 'webpack';
import path from 'path';
import GitRevisionPlugin from 'git-revision-webpack-plugin';
6 years ago
import HtmlWebpackPlugin from 'html-webpack-plugin';
import WebpackBuildNotifierPlugin from 'webpack-build-notifier';
import packageJson from '../package.json';
5 years ago
import { SRC, BUILD, PORT, PUBLIC, TRANSLATIONS } from './constants';
6 years ago
// turn on for bundle analyzing
// import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
const gitRevisionPlugin = new GitRevisionPlugin();
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: {
// host: '0.0.0.0',
5 years ago
contentBase: [SRC, PUBLIC],
5 years ago
stats: 'minimal',
6 years ago
hot: true,
https: false,
5 years ago
quiet: false,
6 years ago
port: PORT,
inline: true,
},
module: {
rules: [
{
test: /\.js?$/,
6 years ago
exclude: /node_modules/,
use: [
'babel-loader',
'react-hot-loader/webpack',
{
loader: 'eslint-loader',
options: {
emitWarning: true,
},
},
{
loader: 'stylelint-custom-processor-loader',
options: {
emitWarning: true,
configPath: '.stylelintrc',
},
},
],
6 years ago
},
{
test: /\.(png|gif|jpg)$/,
loader: 'file-loader?name=./images/[name].[ext]',
options: {
outputPath: './images',
name: '[name].[ext]',
6 years ago
},
6 years ago
},
{
test: /\.(ttf|eot|svg|woff|woff2)$/,
loader: 'file-loader',
options: {
outputPath: './fonts',
name: '[name].[ext]',
},
},
{
type: 'javascript/auto',
test: /\.json/,
exclude: [/(node_modules)/, TRANSLATIONS],
loader: 'file-loader',
options: {
outputPath: './data',
name: '[name].[ext]',
6 years ago
},
},
6 years ago
],
6 years ago
},
resolve: {
alias: {
public: PUBLIC,
react: path.resolve('./node_modules/react'),
'react-dom': '@hot-loader/react-dom',
},
6 years ago
modules: [SRC, 'node_modules'],
symlinks: false,
6 years ago
},
performance: {
6 years ago
hints: false,
6 years ago
},
plugins: [
new WebpackBuildNotifierPlugin({
title: 'Trezor Wallet',
suppressSuccess: true,
}),
new webpack.DefinePlugin({
VERSION: JSON.stringify(packageJson.version),
COMMITHASH: JSON.stringify(gitRevisionPlugin.commithash()),
}),
6 years ago
new HtmlWebpackPlugin({
chunks: ['index'],
template: `${SRC}index.html`,
filename: 'index.html',
6 years ago
inject: true,
favicon: `${SRC}images/favicon.ico`,
6 years ago
}),
// new BundleAnalyzerPlugin({
// openAnalyzer: false,
// analyzerMode: false, // turn on to generate bundle pass 'static'
// reportFilename: 'bundle-report.html',
// }),
6 years ago
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(),
6 years ago
],
};