1234567891011121314151617181920212223242526272829303132333435 |
- const webpack = require('webpack')
- const path = require('path')
- const version = require('./package.json').version
- const argv = require('yargs').argv
- let channel = argv.env
- console.log("argv.env,channel",channel)
- module.exports = {
- entry: {
- [`qcsdkIAA-${version}`]: './src/index.js'
- },
- mode: 'production',
- module: {
- rules: [
- {
- test: /\.js$/,
- exclude: /node_modules/,
- loader: 'babel-loader',
- options: {
- presets: ['env'],
- plugins: ['transform-object-rest-spread']
- }
- }
- ]
- },
- output: {
- path: path.resolve(__dirname, `./dist/${channel}`),
- filename: '[name].js',
- libraryTarget: "commonjs2"
- },
- plugins: [
- new webpack.DefinePlugin({
- BUILD_ENV: JSON.stringify(channel)
- })
- ]
- }
|