Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

支持配置 chunks、scripts、headScripts、metas 和 links #1086

Closed
sorrycc opened this issue Sep 16, 2018 · 4 comments
Closed

支持配置 chunks、scripts、headScripts、metas 和 links #1086

sorrycc opened this issue Sep 16, 2018 · 4 comments

Comments

@sorrycc
Copy link
Member

sorrycc commented Sep 16, 2018

e.g.

export default {
  plugins: [
    ['umi-plugin-react', {
      chunks: ['vendor', 'umi'],
      scripts: [
        { src: 'http://cdn/a.js' },
        { src: '<%= PUBLIC_PATH %>a.js' },
        { content: `alert('a');` },
      ],
      headScripts: [],
      metas: [
        { charset: 'utf-8' },
      ],
      links: [
        { rel: 'stylesheet', href: 'http://cdn/a.css' },
      ],
    }],
  ],
}

说明:

  • chunks 默认是 ['umi'],可修改,比如做了 vendors 依赖提取之后,会需要在 umi.js 之前加载 vendors.js
  • headScripts 放在 <head> 里,在 umi.js 之前
  • scripts 在 umi.js 后面
  • scripts、headScripts 以及 links 的 href 属性,支持 publicPath 变量
  • 可使用 <%= PUBLIC_PATH %> 指向 publicPath
@Jeephe
Copy link

Jeephe commented Sep 18, 2018

请问这个功能将在哪个版本发布

@sorrycc
Copy link
Member Author

sorrycc commented Sep 18, 2018

下个版本。

@dengfuping
Copy link
Contributor

需要更新下 umi-plugin-react 的配置文档

SwordsmanYao added a commit to SwordsmanYao/umi that referenced this issue Dec 14, 2018
sorrycc pushed a commit that referenced this issue Dec 18, 2018
@xlei1123
Copy link

image
这个地方是vendors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants