Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

Commit

Permalink
fix: 修复无法解析字体文件的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
AnnaSearl authored and yesmeck committed May 6, 2020
1 parent e09e468 commit 9a325d6
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
@font-face {
font-family: 'iconfont';
src: url('data:font/ttf;base64,') format('truetype');
}


.a {
/* 避免添加 postcss 插件后删除了 remax 自身的插件,测试 px to rpx 功能 */
height: 10rpx;
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
@font-face {
font-family: 'iconfont';
src: url('../assets/iconfont.ttf') format('truetype');
}


.a {
/* 避免添加 postcss 插件后删除了 remax 自身的插件,测试 px to rpx 功能 */
height: 10px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1732,11 +1732,6 @@ function createAppConfig(App) {
_container: new _AppContainer__WEBPACK_IMPORTED_MODULE_3__["default"](_this),
_pages: [],
_instance: react__WEBPACK_IMPORTED_MODULE_1__["createRef"](),
onLaunch: function onLaunch(options) {
this._render();

return this.callLifecycle(_lifecycle__WEBPACK_IMPORTED_MODULE_5__["AppLifecycle"].launch, options);
},
callLifecycle: function callLifecycle(lifecycle) {
var _a;

Expand Down Expand Up @@ -1785,6 +1780,11 @@ function createAppConfig(App) {
}
};
var lifecycleEvent = {
onLaunch: function onLaunch(options) {
this._render();

return this.callLifecycle(_lifecycle__WEBPACK_IMPORTED_MODULE_5__["AppLifecycle"].launch, options);
},
onShow: function onShow(options) {
return this.callLifecycle(_lifecycle__WEBPACK_IMPORTED_MODULE_5__["AppLifecycle"].show, options);
},
Expand Down
6 changes: 6 additions & 0 deletions packages/remax-cli/src/build/webpack/config.mini.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,12 @@ export default function webpackConfig(api: API, options: Options, target: Platfo
.use('file')
.loader(require.resolve('file-loader'));

config.module
.rule('font')
.test(/\.(ttf|eot|woff|woff2)$/i)
.use('file')
.loader(require.resolve('file-loader'));

config.plugin('webpackbar').use(WebpackBar, [{ name: target }]);

config.plugin('mini-css-extract-plugin').use(MiniCssExtractPlugin, [{ filename: `[name]${meta.style}` }]);
Expand Down
6 changes: 6 additions & 0 deletions packages/remax-cli/src/build/webpack/config.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ export default function webpackConfig(api: API, options: Options): Configuration
.use('file')
.loader(require.resolve('file-loader'));

config.module
.rule('font')
.test(/\.(ttf|eot|woff|woff2)$/i)
.use('file')
.loader(require.resolve('file-loader'));

const entryTemplate = fs.readFileSync(path.resolve(__dirname, '../../../template/entry.js.ejs'), 'utf-8');
const pages = entries.pages.map(p => {
const ext = path.extname(p);
Expand Down

1 comment on commit 9a325d6

@vercel
Copy link

@vercel vercel bot commented on 9a325d6 May 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.