• react-webpack(二)


    const path = require('path');
    const webpack = require('webpack');
    const HtmlWebpackPlugin = require('html-webpack-plugin');
    const ExtractTextPlugin = require("extract-text-webpack-plugin");
    
    module.exports = {
        entry: './src/app.jsx',
        output: {
            path: path.join(__dirname, 'dist'),
            filename: 'js/app.js'
        },
        module: {
            rules: [
                {
                    test: /.jsx$/,
                    exclude: /(node_modules)/,
                    use: {
                        loader: 'babel-loader',
                        options: {
                            presets: ['env', 'react']
                        }
                    }
                },
                {
                    test: /.css$/,
                    loader: ExtractTextPlugin.extract({
                        use: "css-loader",
                        fallback: "style-loader"
                    })
                },
                {
                    test: /.scss$/,
                    loader: ExtractTextPlugin.extract({
                        use: 'css-loader!sass-loader',
                        fallback: 'style-loader'
                    })
                },
                {
                    test: /.(gif|jpg|png|woff|svg|eot|ttf)??.*$/,
                    use: [{
                        loader: 'url-loader',
                        options: {
                            name: '[path][name].[ext]',
                            limit: 2000
                        }
                    }]
                }
            ]
        },
        resolve: {
            alias: {
                node_modules: path.join(__dirname, '/node_modules'),
                util: path.join(__dirname, '/src/util'),
                component: path.join(__dirname, '/src/component'),
                service: path.join(__dirname, '/src/service'),
                page: path.join(__dirname, '/src/page'),
                styles: path.join(__dirname, '/src/styles')
            }
        },
        devServer: {
            port: '8088', //设置端口号
                          // 路径的配置
            historyApiFallback: {
                index: '/dist/index.html'
            },
            proxy: {
                '/manage': {
                    target: 'http://test.happymmall.com/',
                    changeOrigin: true
                },
                '/user/logout.do': {
                    target: 'http://test.happymmall.com/',
                    changeOrigin: true
                }
            }
        },
        plugins: [
            new webpack.optimize.CommonsChunkPlugin({
                name: 'common',
                filename: 'js/base.js'
            }),
            new HtmlWebpackPlugin({
                template: './src/index.html',
                filename: 'index.html',
                favicon: './favicon.ico'
            }),
            new ExtractTextPlugin("[name].css")
        ]
    };
  • 相关阅读:
    RabbitMQ入门-Topic模式
    RabbitMQ入门-路由-有选择的接受消息
    RabbitMQ入门-发布订阅模式
    RabbitMQ入门-竞争消费者模式
    RabbitMQ入门-队列
    Windows下安装RabbitMQ
    ThymeLeaf的eclipse插件安装
    Freemarker 的 Eclipse 插件 安装
    MySQL基础学习笔记
    我是不是一个不愿意自己多努力,还老是跟别人吐槽公司这不好那不好的人
  • 原文地址:https://www.cnblogs.com/Nyan-Workflow-FC/p/8557289.html
Copyright © 2020-2023  润新知