【问题标题】:Assets Folder Not Including HTML Files In NativeScript Android Build资产文件夹不包括 NativeScript Android 构建中的 HTML 文件
【发布时间】:2019-05-14 19:25:09
【问题描述】:
我正在尝试显示一个本地 html 文件,其中包含它所引用的 JS、CSS 和 PNG 图像。我将文件放入我的用于 Android 的 NativeScript x Angular 应用程序的资产文件夹中。当我运行 tns run android --bundle 并构建应用程序时 - 资产文件夹不包含 html。文件夹结构来自 assets > index.html(并且 index.html 引用其他文件)。
我是否需要在某个地方或方式中包含 html 文件以便将它们包含在构建中?
【问题讨论】:
标签:
android
nativescript
angular2-nativescript
nativescript-angular
nativescript-telerik-ui
【解决方案1】:
您必须更新 webpack.config.js 中的 CopyWebpackPlugin 以包含资产文件夹
// Copy assets to out dir. Add your own globs as needed.
new CopyWebpackPlugin([
{ from: "fonts/**" },
{ from: "**/*.jpg" },
{ from: "**/*.png" },
{ from: "assets/**" }, // Add your asset folder path like this
], { ignore: [`${relative(appPath, appResourcesFullPath)}/**`] }),