Search code examples
androidnativescriptangular2-nativescriptnativescript-angularnativescript-telerik-ui

Assets Folder Not Including HTML Files In NativeScript Android Build


I am trying to display a local html file with JS and CSS and PNG images referenced by it. I put the files into my assets folder of a NativeScript x Angular app for Android. When I run tns run android --bundle and the app gets built - the assets folder does not include the html. Folder structure goes from assets > index.html (and index.html references the other files).

Is there a certain place or way I need to include html files so they get included in the build?


Solution

  • You must update CopyWebpackPlugin in your webpack.config.js to include the asset folder

    // 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)}/**`] }),