简体   繁体   English

使用 react-app-rewired 设置多个条目

[英]Set multiple entries using react-app-rewired

Below are some options from an open-webpack (not CRA) react project:以下是来自 open-webpack(不是 CRA)react 项目的一些选项:

// webpack.config.js

module.exports = {
    // ...
    entry: {
        main: './src/index.js',
        'editor.worker': 'monaco-editor/esm/vs/editor/editor.worker.js',
        'yaml.worker': 'monaco-yaml/lib/esm/yaml.worker.js',
    },
    // ...

How to implement similar configuration in config-overrides.js (using react-app-rewired )?如何在config-overrides.js实现类似的配置(使用react-app-rewired )?

// config-overrides.js

module.exports = function override (config) {
    config.entry = // ???

    return config
}

My experience:我的经验:

Simply set it to:只需将其设置为:

config.entry = {
    main: './src/index.js',
    'editor.worker': 'monaco-editor/esm/vs/editor/editor.worker.js',
    'yaml.worker': 'monaco-yaml/lib/esm/yaml.worker.js',
}

doesn't work.不起作用。 It even causes issues in loading index.js !它甚至会导致加载index.js出现问题!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM