File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313
1414This plugin generates a Drupal asset library file based on a webpack build.
1515
16+ It requires webpack 5 to work. For webpack 4 use the ` 1.x ` version of this plugin.
17+
1618<h2 align =" center " >Install</h2 >
1719
1820``` bash
@@ -24,6 +26,8 @@ npm install --save-dev drupal-libraries-webpack-plugin
2426** webpack.config.js**
2527
2628``` js
29+ const DrupalLibrariesPlugin = require (' drupal-libraries-webpack-plugin' );
30+
2731module .exports = {
2832 plugins: [
2933 new DrupalLibrariesPlugin ()
@@ -73,7 +77,7 @@ Split a library into multiple library files.
7377module .exports = {
7478 plugins: [
7579 new DrupalLibrariesPlugin ({
76-
80+
7781 path : (library , metadata ) => {
7882 const lib1 = new DrupalLibraryFile (' a.libraries.yml' ),
7983 lib2 = new DrupalLibraryFile (' webpack.libraries.yml' )
@@ -86,7 +90,7 @@ module.exports = {
8690 lib2 .add (name, library, metadata)
8791 }
8892 })
89-
93+
9094 return [lib1, lib2]
9195 }
9296 })
@@ -184,7 +188,7 @@ class StaticVersionLibraryGenerator extends DrupalLibraryEntryGenerator {
184188 constructor (version ) {
185189 this .version = version
186190 }
187-
191+
188192 async versionGenerator (metadata ) {
189193 return this .version
190194 }
Original file line number Diff line number Diff line change 11exports = module . exports = require ( './lib/DrupalLibrariesPlugin' )
22
3- // @deprecated : remove in 2.x
4- exports . DrupalLibrariesPlugin = require ( './lib/DrupalLibrariesPlugin' )
5-
63exports . DrupalLibraryMetadata = require ( './lib/DrupalLibraryMetadata' )
74exports . DrupalLibraryEntryGenerator = require ( './lib/DrupalLibraryEntryGenerator' )
85exports . DrupalLibraryFile = require ( './lib/DrupalLibraryFile' )
9- exports . DrupalLibraryModule = require ( './lib/DrupalLibraryFile ' )
6+ exports . DrupalLibraryModule = require ( './lib/DrupalLibraryModule ' )
Original file line number Diff line number Diff line change 11const path = require ( 'path' ) ,
22 MiniCssExtractPlugin = require ( 'mini-css-extract-plugin' ) ,
3- DrupalLibrariesPlugin = require ( '../' ) . DrupalLibrariesPlugin ,
3+ DrupalLibrariesPlugin = require ( '../' ) ,
44 runWebpack = require ( './lib/webpack-wrapper' )
55
66test ( 'Adds css assets to libraries' , async ( ) => {
Original file line number Diff line number Diff line change 1- const DrupalLibraryModule = require ( '../lib/DrupalLibraryModule' )
1+ const DrupalLibraryModule = require ( '../' ) . DrupalLibraryModule
22
33test ( 'DrupalLibraryModule instantiates without error' , async ( ) => {
44 await expect ( ( ) => new DrupalLibraryModule ( ) ) . not . toThrow ( )
Original file line number Diff line number Diff line change 11const webpack = require ( 'webpack' ) ,
22 path = require ( 'path' ) ,
3- DrupalLibrariesPlugin = require ( '../../' ) . DrupalLibrariesPlugin
3+ DrupalLibrariesPlugin = require ( '../../' )
44
55module . exports = async ( webpackOpts , pluginOpts , extraPlugins ) => {
66 extraPlugins = extraPlugins || [ ]
Original file line number Diff line number Diff line change 1- const DrupalLibrariesPlugin = require ( '../' ) . DrupalLibrariesPlugin ,
1+ const DrupalLibrariesPlugin = require ( '../' ) ,
22 DrupalLibraryEntryGenerator = require ( '../' ) . DrupalLibraryEntryGenerator
33
44test ( 'Default name generator handles invalid library names' , async ( ) => {
You can’t perform that action at this time.
0 commit comments