1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- const webpack = require('webpack')
- const path = require('path')
- const HtmlWebpackPlugin = require('html-webpack-plugin')
- const config =
- {
- output: {
- path: path.join(__dirname, 'dist'),
- filename: 'bundle.js',
- globalObject: 'this'
- },
- module: {
- rules: [
- {
- test: /\.worker\.js$/, //以.worker.js结尾的文件将被worker-loader加载
- use: { loader: 'worker-loader' }
- },
- {
- test: /\.js$/,
- exclude: /node_modules/,
- use: {
- loader: 'babel-loader'
- }
- },
- {
- test: /\.css$/,
- use: [
- {loader: 'style-loader'},
- {loader: 'css-loader'},
- {
- loader: 'postcss-loader',
- options: {
- plugins: [require('autoprefixer')]
- }
- }
- ]
- },
- {
- test: /\.(png|jpg|gif|woff|eot|ttf|svg)$/,
- use: {
- loader: 'url-loader',
- options: {
- limit: 8192,
- name: "assets/[name].[ext]"
- }
- }
- }
- ]
- },
- plugins: [
- new webpack.HotModuleReplacementPlugin(),
- new HtmlWebpackPlugin({
- template: path.join(__dirname, 'src/index.html'),
- minify: {
- removeComments: false,
- collapseWhitespace: false
- }
- })
- ]
- // ,
- // devServer: {
- // contentBase: path.join(__dirname, "dist"),
- // port: 8000,
- // hot: true
- // }
- }
- module.exports = config
|