123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- const path = require('path');
- const VueLoaderPlugin = require('vue-loader/lib/plugin')
- const CopyWebpackPlugin = require('copy-webpack-plugin')
- const projectName = "accountability"
- module.exports = {
- entry: {
- singleSpaEntry:['src/singleSpaEntry.js']
- },
- output: {
- filename: '[name].js',
- path: path.resolve(__dirname, 'accountability'),
- libraryTarget: 'umd',
- library: 'accountability',
- },
- module: {
- rules: [
- {
- test: /\.vue$/,
- loader: 'vue-loader',
- options: {
- loaders: {
- js: 'babel-loader'
- },
- },
- },
- {
- test: /\.js$/,
- loader: 'babel-loader',
- exclude: /node_modules/,
- include: path.join(__dirname, './src'),
- },
- {
- test: /\.(png|jpg|gif|svg)$/,
- loader: 'file-loader',
- options: {
- name: '[name].[ext]?[hash]',
- publicPath: `../${projectName}`,
- }
- },
- {
- test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
- loader: 'url-loader',
- options: {
- limit: 100000,
- name: 'fonts/[name].[hash:7].[ext]',
- publicPath: `../${projectName}`,
- }
- },
- {
- test: /\.css$/,
- use: [
- 'vue-style-loader',
- 'css-loader'
- ]
- },
- {
- test: /\.scss$/,
- loaders: ["vue-style-loader", "css-loader", "sass-loader"]
- }
- ]
- },
- resolve: {
- alias: {
- 'vue$': 'vue/dist/vue.esm.js',
- '@': path.join(__dirname, './src'),
- },
- extensions: [
- ".js", ".vue"
- ],
- modules: [
- __dirname,
- 'node_modules',
- ],
- },
- mode: 'development',
- devtool: 'none',
- externals: [],
- plugins: [
- new CopyWebpackPlugin([
- {
- from: path.resolve(__dirname, './static'),
- to: __dirname+'/release',
- ignore: ['.*']
- }
- ]),
- new VueLoaderPlugin()
- ],
- devServer: {
- // host:'192.168.40.203',
- contentBase: './release',
- historyApiFallback: true,
- watchOptions: { aggregateTimeout: 300, poll: 1000 },
- headers: {
- "Access-Control-Allow-Origin": "*",
- "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS",
- "Access-Control-Allow-Headers": "X-Requested-With, content-type, Authorization"
- },
- // Proxy config for development purposes. In production, you would configure you webserver to do something similar.
- proxy: {
- // "/grainReserves": {
- // target: "http://localhost:9004",
- // pathRewrite: { "^/grainReserves": "" },
- // },
- // "/myuser": {
- // target: "http://218.241.206.66:8097/myuser",
- // pathRewrite: {"^/myuser" : ""},
- // },
- // "/myuser": {
- // target: "http://192.168.80.230:8097/myuser",
- // pathRewrite: { "^/myuser": "" },
- // },
- '/api': {
- target: 'http://lswz:9090/api', //
- secure: false, // 如果是https接口,需要配置这个参数
- changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
- pathRewrite: {
- '^/api': ''
- }
- },
- },
- }
- };
|