New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@wecity/script-env-config

Package Overview
Dependencies
Maintainers
18
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wecity/script-env-config

## 后置脚本替换资源路径

latest
npmnpm
Version
1.0.0
Version published
Maintainers
18
Created
Source

@wecity/script-env-conifg

后置脚本替换资源路径

解决问题:打包后,可以修改配置文件,执行后置脚本替换项目内所有资源路径

概述

  • 1、使用插件后,前端构建目录下会创建名为env.config以及名为env.sh的两个文件
  • 2、env.config:配置资源路径地址,动态修改此配置后,需执行env.sh来重新生成物料包
  • 3、env.sh:执行替换脚本,一般情况下不需要手动修改

快速使用

yarn add @wecity/script-env-config
const ScriptEnvConfig = require('@wecity/script-env-config').default

module.exports = {
  ...
  chainWebpack: config => {
    config.plugin('script-env-config').use(
      new ScriptEnvConfig({
        var: '==@SCRIPT-ENV-CONFIG-VAR@==',
        resourcePrefix: '/test123/ccc'
      })
    )
  },
  ...
}
# 如构建目录在dist下
cd dist
sh ./env.sh

执行构建完成后,在构建目录下执行 sh ./env.sh 即可根据env.config配置内容创建物料包

FAQs

Package last updated on 08 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts