How to use the copy-webpack-plugin.__expression function in copy-webpack-plugin

To help you get started, we’ve selected a few copy-webpack-plugin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github egoist / poi / packages / poi / lib / plugins / config-base.js View on Github external
POI_PUBLIC_PATH: JSON.stringify(api.config.publicPath),
          POI_COMMAND: JSON.stringify(api.command),
          __DEV__: JSON.stringify(api.command !== 'build')
        },
        api.config.constants
      )
    ])

    // Copy ./public/* to out dir
    // In non-dev commands since it uses devServerOptions.contentBase instead
    if (
      api.options.command !== 'dev' &&
      fs.existsSync(api.resolveBaseDir('public'))
    ) {
      const CopyPlugin = require('copy-webpack-plugin')
      CopyPlugin.__expression = `require('copy-webpack-plugin')`

      api.chainWebpack(config => {
        config.plugin('copy-public').use(CopyPlugin, [
          [
            {
              from: api.resolveBaseDir('public'),
              to: '.',
              ignore: ['.DS_Store']
            }
          ]
        ])
      })
    }

    // Resolve loaders and modules in poi's node_modules folder
    const inWorkspaces = __dirname.includes('/poi/packages/poi/')

copy-webpack-plugin

Copy files && directories with webpack

MIT
Latest version published 10 months ago

Package Health Score

91 / 100
Full package analysis

Popular copy-webpack-plugin functions