const { defineConfig } = require('@vue/cli-service')
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin')
const path = require('path')
function resolve(dir) {
  return path.join(__dirname, dir)
}
module.exports = defineConfig({
  transpileDependencies: true,
  publicPath: "/",
  lintOnSave:false,
  transpileDependencies: true,
  productionSourceMap: false,
  devServer: {
    port: 1090,
    // proxy: {
    //   '/infoapi': {
    //     target: 'https://info.jiduzq.com/v1/',
    //     changeOrigin: true,
    //     pathRewrite: {
    //       '^/infoapi': '/'
    //     }
    //   },
    // }
  },
  configureWebpack: {
    // provide the app's title in webpack's name field, so that
    // it can be accessed in index.html to inject the correct title.
    name: 'name',
    resolve: {
      alias: {
        '@': resolve('src')
      },
      fallback: {
        //其他的如果不启用可以用 keyname :false，例如：crypto:false, 
        "crypto": require.resolve("crypto-browserify"),
        "stream": require.resolve("stream-browserify")
      },
    },
    plugins: [new NodePolyfillPlugin()]
  },
})
