How to use the @wordpress/scripts/config/webpack.config.plugins function in @wordpress/scripts

To help you get started, we’ve selected a few @wordpress/scripts 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 ampproject / amp-wp / qa-tester / webpack.config.js View on Github external
...defaultConfig.module,
		rules: [
			...defaultConfig.module.rules,
			{
				test: /\.css$/,
				use: [
					// prettier-ignore
					MiniCssExtractPlugin.loader,
					'css-loader',
					'postcss-loader',
				],
			},
		],
	},
	plugins: [
		...defaultConfig.plugins,
		new MiniCssExtractPlugin( {
			filename: '../css/[name]-compiled.css',
		} ),
		new RtlCssPlugin( {
			filename: '../css/[name]-compiled-rtl.css',
		} ),
	],
};

const adminBar = {
	...defaultConfig,
	...sharedConfig,
	entry: {
		'admin-bar': [ './assets/src/js/admin-bar/index.js' ],
	},
	plugins: [
github xwp / wp-foo-bar / webpack.config.js View on Github external
...defaultConfig.module,
		rules: [
			...defaultConfig.module.rules,
			{
				test: /\.css$/,
				use: [
					// prettier-ignore
					MiniCssExtractPlugin.loader,
					'css-loader',
					'postcss-loader',
				],
			},
		],
	},
	plugins: [
		...defaultConfig.plugins,
		new MiniCssExtractPlugin( {
			filename: '../css/[name]-compiled.css',
		} ),
		new RtlCssPlugin( {
			filename: '../css/[name]-compiled-rtl.css',
		} ),
	],
};

const blockEditor = {
	...defaultConfig,
	...sharedConfig,
	entry: {
		'block-editor': [
			'./assets/src/block-editor/index.js',
			'./assets/css/src/block-editor.css',
github insideout10 / wordlift-plugin / src-js / webpack / webpack.config.js View on Github external
// @see https://webpack.js.org/loaders/sass-loader/#extracting-style-sheets
          MiniCssExtractPlugin.loader,
          "css-loader",
          "sass-loader" // compiles Sass to CSS, using Node Sass by default
        ]
      },
      {
        test: /.svg$/,
        use: {
          loader: "svg-react-loader"
        }
      }
    ]
  },
  plugins: [
    ...defaultConfig.plugins,
    // @see https://webpack.js.org/loaders/sass-loader/#extracting-style-sheets
    new MiniCssExtractPlugin({
      filename: "[name].css"
    })
  ],
  externals: {
    ...defaultConfig.externals,
    backbone: "Backbone"
  }
};

// Create the full configuration for files that will include all the dependencies to keep WordPress pre 5.0.0 compatibility.
const webpackConfigFull = { ...webpackConfig };
// Remove the `DependencyExtractionWebpackPlugin`.
webpackConfigFull.plugins = webpackConfig.plugins.filter(
  entry => !(entry instanceof DependencyExtractionWebpackPlugin)
github Charitable / Charitable / webpack.config.js View on Github external
{
                test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
                use: [
                    {
                    loader: 'file-loader',
                    options: {
                        name: '[name].[ext]',
                        outputPath: 'fonts/'
                        }
                    }
                ]
            }
        ]
    },
    plugins: [
        ...defaultConfig.plugins,
        new CopyPlugin({
          patterns: [
            { from: './src/fonts', to: 'fonts' },
            { from: './src/images', to: 'images' },
            { from: './src/libraries/css', to: 'css/libraries' },
            { from: './src/fonts', to: 'css/fonts' },
            { from: './src/libraries/js', to: 'js/libraries' },
          ],
        }),
      ],
};
github gocodebox / lifterlms / packages / scripts / config / webpack.config.js View on Github external
plugins.forEach( ( plugin, index ) => {
		if ( 'MiniCssExtractPlugin' === plugin.constructor.name ) {
			config.plugins.splice( index, 1 );
		}
	} );
github godaddy-wordpress / coblocks / .dev / config / webpack.config.js View on Github external
{
				test: /editor\.scss$/,
				use: styleExtractConfig,
			},

		],
	},

	stats: {
		...defaultConfig.stats,
		modules: false,
		warnings: false,
	},

	plugins: [
		...defaultConfig.plugins,

		new FixStyleOnlyEntriesPlugin(),
		new MiniCssExtractPlugin( {
			filename: '[name].css',
		} ),
	],
};
github johnbillion / query-monitor / webpack.config.js View on Github external
/node_modules/,
        ],
        loader: 'ts-loader',
      },
      {
        enforce: 'pre',
        test: /\.js$/,
        exclude: [
          /node_modules/,
        ],
        loader: 'source-map-loader',
      },
    ],
  },
  plugins: [
    ...defaultConfig.plugins,
    new BellOnBundlerErrorPlugin(),
    new webpack.ProvidePlugin({
      react: 'react',
    }),
  ],
};
github gocodebox / lifterlms / packages / scripts / config / webpack.config.js View on Github external
module.exports = ( { css = [], js = [], prefix = 'llms-', outputPath = 'assets/', srcPath = 'src/' } ) => {

	return {
		...config,
		entry: setupEntry( js, srcPath ),
		output: {
			filename: `js/${ prefix }[name].js`,
			path: path.resolve( process.cwd(), outputPath ),
		},
		plugins: setupPlugins( config.plugins, css, prefix ),
	};

}
github ampproject / amp-wp / webpack.config.js View on Github external
name: 'Admin',
			color: '#67b255',
		} ),
	],
};

const customizer = {
	...defaultConfig,
	...sharedConfig,
	entry: {
		'amp-customize-controls': './assets/src/customizer/amp-customize-controls.js',
		'amp-customize-preview': './assets/src/customizer/amp-customize-preview.js',
		'amp-customizer-design-preview': './assets/src/customizer/amp-customizer-design-preview.js',
	},
	plugins: [
		...defaultConfig.plugins,
		new WebpackBar( {
			name: 'Customizer',
			color: '#f27136',
		} ),
	],
};

const wpPolyfills = {
	...defaultConfig,
	...sharedConfig,
	externals: {},
	plugins: [
		new DependencyExtractionWebpackPlugin( {
			useDefaults: false,
			requestToHandle: ( request ) => {
				switch ( request ) {