ZachJW34 / nx-plus

Collection of Nx Community Plugins
MIT License
302 stars 50 forks source link

Add assets option to browser builder in angular.json #89

Open DavainWhite opened 4 years ago

DavainWhite commented 4 years ago

Description

It would be great if we could included assets from a shared asset library by just adding a assets option to the browser builder. image

Motivation

Helps reduce duplicate assets and massively reduces monoprepo sizes.

Suggested Implementation

have webpack look at the path and copy and and paste everything there into the dist folder. as for duplicate files just overwrite them I guess.

Alternate Implementations

custom webpack but that would take alot of time to setup and doesn't realy follow the nrwl theme of having a single source for webpack stuff (angular.json file)

ghost commented 3 years ago

Hello. Any updates about this?

Did you find a solution?

ghost commented 3 years ago

Any updates about this?

ghost commented 3 years ago

I tried like this and it worked:

const CopyWebpackPlugin = require('copy-webpack-plugin');

module.exports = function (context, options) {
    return {
        name: 'docusaurus-custom-webpack',
        configureWebpack(config, isServer, utils) {
            return {
                plugins: [
                    new CopyWebpackPlugin({
                        patterns: [
                            {
                                from: 'libs/design-system',
                                to: './assets/design-system',
                            },
                        ],
                    }),
                ],
            };
        },
    };
};