生成的工人不传递命令行参数

问题描述

我正在尝试通过脚本传递参数。

"scripts": {
     "build: prod": "cross-env-shell NODE_ENV = production node \" ./ configs / scripts \ "--sc",},

例如使用

"babel-plugin-styled-components"

基于 --sc 参数。 但是在使用线程加载器时,在其他线程中,命令行参数没有传递给我。

[
   '~~~node.exe','~~~node_modules\\thread-loader\\dist\\worker.js','fifty'
]

我该如何解决这个问题。

代码

/* threadLoader.js */
module.exports = ({ name }) => ({
    "loader": "thread-loader","options": {
        // can be used to create different pools with elsewise identical options
        name,// the number of spawned workers,defaults to (number of cpus - 1) or
        // fallback to 1 when require('os').cpus() is undefined
        "workers": 4,// number of jobs a worker processes in parallel
        // defaults to 20
        "workerParallelJobs": 50,// Allow to respawn a dead worker pool
        // respawning slows down the entire compilation
        // and should be set to false for development
        "poolRespawn": production,});

/* babel/plugins.js */
module.exports = ({ development,production,/*process.argv*/ sc }) => {
    const plugins = [
        [
            "@babel/plugin-transform-runtime",{
                "regenerator": true,"corejs": 3,}
        ],[
            "@babel/plugin-proposal-decorators",{
                "legacy": true,sc && "babel-plugin-styled-components",/* ..rest */

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)