sonatype-nexus-community / copy-modules-webpack-plugin

A Webpack plugin which copies module sources to a separate directory
Apache License 2.0
18 stars 7 forks source link

copy-modules-webpack-plugin throw an error with AOT build on Angular project #14

Closed iliesaithamouda closed 4 years ago

iliesaithamouda commented 4 years ago

I am trying to "ng build -c dev" an angular project with the plugin. The build fail when it start the copy-modules-webpack-plugin with an error like this:

95% emitting WebpackCopyModulesPluginAn unhandled exception occurred: ENOENT: no such file or directory, stat '/path-to-my-project/src/app/+ui-kit/table/basic-table.component.scss.shim.ngstyle.js'

Build with AOT angular project

Don't know why or how yet... still looking. If anyone can help 😃

rpokorny commented 4 years ago

Could you post your webpack configuration? I'll admit I'm not specifically familiar with the angular CLI tools but if I can see your configuration that may help.

iliesaithamouda commented 4 years ago

yes for sure.

here's my only webpack conf :

const CopyModulesPlugin = require('copy-modules-webpack-plugin');

module.exports = {
  plugins: [
    new CopyModulesPlugin({
        destination: 'webpack-modules'
    })
  ]
};

here's my angular.json :

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "or-angular": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "prefix": "app",
      "schematics": {
        "@ngrx/schematics:action": {
          "creators": true
        },
        "@ngrx/schematics:effect": {
          "creators": true
        },
        "@ngrx/schematics:reducer": {
          "creators": true
        }
      },
      "architect": {
        "test": {
          "builder": "@angular-builders/jest:run",
          "options": {
            "no-cache": true
          }
        },
        "build": {
          "builder": "@angular-builders/custom-webpack:browser",
          "options": {
            "es5BrowserSupport": true,
            "outputPath": "dist",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.app.json",
            "assets": [
              "src/favicon.ico",
              "src/assets",
              "src/assets/**/*.svg",
              "src/assets/mocks/**/*.html"
            ],
            "scripts": [],
            "styles": [
              "src/app/_fonts.scss",
              "src/styles.scss"
            ],
            "stylePreprocessorOptions": {
              "includePaths": [
                "src/app/core/style",
                "src/app/"
              ]
            },
            "customWebpackConfig": {
              "path": "./webpack.config.js"
            }
          },
          "configurations": {
            "production": {
              "deployUrl": "/etc/clientlibs/AppRoot/js/",
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true
            }
          }
        },
        "serve": {
          "builder": "@angular-builders/custom-webpack:dev-server",
          "options": {
            "browserTarget": "or-angular:build",
            "proxyConfig": "proxy.conf.js",
            "customWebpackConfig": {
              "path": "./webpack.config.js"
            }
          },
          "configurations": {
            "production": {
              "browserTarget": "or-angular:build:production"
            }
          }
        }
      }
    }
  },
  "defaultProject": "or-angular"
}

the only webpack conf that i have is the one as suggested in the readMe.md of this repo

rpokorny commented 4 years ago

Hi @iliesaithamouda, please see if the new version 2.1.1 of the plugin helps your case.

iliesaithamouda commented 4 years ago

Hi @rpokorny , yes now it's working. thank you for fixing the issue 👍