mirror of https://github.com/alibaba/ice.git
* feat: support externals field in assets-manifest (#7116) * chore: version * chore: update version |
||
---|---|---|
.. | ||
src | ||
CHANGELOG.md | ||
README.md | ||
package.json | ||
tsconfig.json |
README.md
@ice/plugin-externals
@ice/plugin-externals
is a ice.js plugin. It provides a simple way to add externals support to your application.
Install
$ npm i @ice/plugin-externals --save-dev
Usage
Set preset react
to external react in a easy way.
import { defineConfig } from '@ice/app';
import externals from '@ice/plugin-externals';
export default defineConfig(() => ({
plugins: [externals({ preset: 'react' })]
}));
Framework will auto add externals of react
and react-dom
to your application, and the cdn url will be inject to the document by default.
Also, you can custom externals and cdn url by yourself:
import { defineConfig } from '@ice/app';
import externals from '@ice/plugin-externals';
export default defineConfig(() => ({
plugins: [externals({
externals: {
antd: 'Antd',
},
cdnMap: {
antd: {
development: 'https://unpkg.com/antd/dist/antd.js',
production: 'https://unpkg.com/antd/dist/antd.min.js',
}
}
})]
}));