| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- const path = require('path')
- const webpack = require('webpack')
- const copyWebpackPlugin = require('copy-webpack-plugin')
- const htmlWebpackPlugin = require('html-webpack-plugin')
- module.exports = {
- entry: {
- env: './config/env.js'
- },
- output: {
- path: path.resolve(__dirname, 'dist'),
- filename: 'js/[name].js'
- },
- module: {
- rules: [{
- test: /\.css$/,
- use: [
- { loader: 'style-loader' },
- {
- loader: 'css-loader',
- options: { modules: true}
- }
- ]
- }]
- },
- plugins: [
- new htmlWebpackPlugin({
- filename: 'index.html',
- template: './src/index.html',
- inject: 'head'
- }),
- new copyWebpackPlugin([{
- from: path.resolve(__dirname, 'src'),
- to: path.resolve(__dirname, 'dist'),
- ignore: ["index.html", "js/env.js"]
- }]),
- new webpack.HotModuleReplacementPlugin()
- ],
- devServer: {
- clientLogLevel: 'warning',
- quiet: true,
- open: true,
- contentBase: path.join(__dirname, "dist"),
- port: 80,
- host: '127.0.0.1'
- }
- }
|