@jswork/file-callback-webpack-plugin
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

file-callback-webpack-plugin

File callback webpack plugin.

version license size download

installation

npm install @jswork/file-callback-webpack-plugin

usage

const { defineConfig } = require('@vue/cli-service');
const FileCbPlugin = require('@jswork/file-callback-webpack-plugin');
const { envname } = require('@jswork/ci-kits');
const ENVS = require('./.env-cmdrc');
const currentEnvs = ENVS[envname()];

// usage
const manifestReplace = new FileCbPlugin({
  path: 'src/manifest.json',
  callback: (content) => {
    nx.set(
      content,
      'mp-weixin.appid',
      JSON.parse(currentEnvs['VUE_APP_APP_ID'])
    );
    return content;
  }
});

module.exports = defineConfig({
  configureWebpack: (config) => {
    const plugins = config.plugins;
    config.devtool = 'source-map';
    config.plugins = [...plugins, manifestReplace];
  }
});

license

Code released under the MIT license.

Package Sidebar

Install

npm i @jswork/file-callback-webpack-plugin

Homepage

js.work

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

8.93 kB

Total Files

6

Last publish

Collaborators

  • afeiship