123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- const { CleanWebpackPlugin } = require('clean-webpack-plugin');
- const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin');
- const WebpackBar = require('webpackbar');
- const paths = require('../utils/paths');
- module.exports = env => ({
- mode: env.mode,
- context: paths.SRC_DIR,
- entry: './index.js',
- output: {
- path: paths.BUILD_DIR,
- },
- module: {
- rules: [
- {
- test: /\.js$/,
- include: paths.SRC_DIR,
- use: ['babel-loader'],
- },
- {
- test: /\.(gif|png|jpe?g|svg)$/i,
- use: [
- {
- loader: 'url-loader',
- options: {
- name: '[path][name].[ext]',
- limit: 8192,
- esModule: false,
- },
- },
- 'img-loader',
- ],
- },
- {
- test: /\.woff(2)?(\?[a-z0-9#=&.]+)?$/,
- use: [
- {
- loader: 'url-loader',
- options: {
- name: '[name].[ext]',
- outputPath: 'fonts/',
- limit: 10000,
- mimetype: 'application/font-woff',
- },
- },
- ],
- },
- {
- test: /\.(ttf|eot)(\?v=\d+\.\d+\.\d+)?$/,
- use: [
- {
- loader: 'file-loader',
- options: {
- name: '[name].[ext]',
- outputPath: 'fonts/',
- },
- },
- ],
- },
- {
- test: /\.html$/,
- use: 'html-loader',
- },
- {
- test: /\.hbs$/,
- use: 'handlebars-loader',
- },
- ],
- },
- plugins: [
- new CleanWebpackPlugin(),
- new FriendlyErrorsWebpackPlugin(),
- new WebpackBar(),
- ],
- });
|