Skip to content

fex-team/fis3-preprocessor-js-require-file

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

fis3-preprocessor-js-require-file

支持 js 中直接 require 文件. (es6 的 import 也支持,但是先通过 es6 => es5 的转换。)

只能在 fis3 中使用。

如果想 require css, 请使用 fis3-preprocessor-js-require-css,可以一起使用。

npm install -g fis3-preprocessor-js-require-file

使用方式配置如下:

fis.match('*.{js,es,es6,jsx,ts,tsx}', {
  preprocessor: fis.plugin('js-require-file')
})

参数说明

useEmbedWhenSizeLessThan: 默认 20K。即:当目标文件的体积小于 20k 时,自动用 base64 引入。 大于 20K 时,用目标文件的 url. 如果不想启用此功能,请设置为 0 或者 null, false 都可以。

About

用来支持 js 中 require 非 js 和 非 css 文件的用法。

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published