Nativescript Angular code sharing project problem with Webpack

后端 未结 2 883
情深已故
情深已故 2020-12-22 01:21

I have created a code-sharing projects with Angular 8.30 and Nativescript.

When I run ng serve, the app builds ok. However with tns run android

相关标签:
2条回答
  • 2020-12-22 02:15

    The same happened to me and When I try to edit webpack.config.js it works for me just replace the lines

     new CopyWebpackPlugin([
                { from: { glob: "fonts/**" } },
                { from: { glob: "**/*.jpg" } },
                { from: { glob: "**/*.png" } },
            ], { ignore: [`${relative(appPath, appResourcesFullPath)}/**`] }),
    

    to be

    new CopyWebpackPlugin({
                patterns: [
                  { from: "fonts/**", globOptions: { ignore: [`${relative(appPath, appResourcesFullPath)}/**`] } },
                  { from: "**/*.{jpg,png}", globOptions: { ignore: [`${relative(appPath, appResourcesFullPath)}/**`] } },
                ]
              }, { ignore: [`${relative(appPath, appResourcesFullPath)}/**`] }),
    

    and do not forget to add fonts folder if you do not have one

    0 讨论(0)
  • 2020-12-22 02:17

    Actually, this issue is related to version of "@angular-devkit/build-angular".

    For me works!

    • After generating code sharing project:
      1. Drop folders: 'hooks', 'node_modules', 'platforms'
      2. Drop files: 'package-lock.json', 'webpack.config.js'
      3. Change version of '@angular-devkit/build-angular' from current (~0.803.0) to ~0.7.0 ; Then run npm install
      4. Then change '@angular-devkit/build-angular' version to current one (~0.803.0). Then run nmp install
      5. Test: tns run ios --bundle
    0 讨论(0)
提交回复
热议问题