PluginProbe
Photonic Gallery & Lightbox for Flickr, SmugMug & Others / 3.37
Photonic Gallery & Lightbox for Flickr, SmugMug & Others v3.37
3.37 3.36 3.35 3.34 3.33 2.19 2.20 2.21 2.22 2.23 2.24 2.25 2.26 2.27 2.28 2.29 2.30 2.31 2.32 2.33 2.34 2.40 2.41 2.42 2.43 All 142 releases
photonic / grunt / webpack.config.js

webpack.config.js in Photonic Gallery & Lightbox for Flickr, SmugMug & Others 3.37, at grunt/webpack.config.js

178 lines 5.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 const path = require('path');
2 //require('webpack');
3
4 // Create the entry points - one per lightbox
5 const entryPoints = {
6 solo: {
7 baguettebox: ['../include/js/front-end/src/Entries/BaguetteBox.js'],
8 bigpicture: ['../include/js/front-end/src/Entries/BigPicture.js'],
9 colorbox: ['../include/js/front-end/src/Entries/Colorbox.js'],
10 fancybox: ['../include/js/front-end/src/Entries/Fancybox.js'],
11 fancybox2: ['../include/js/front-end/src/Entries/Fancybox2.js'],
12 fancybox3: ['../include/js/front-end/src/Entries/Fancybox3.js'],
13 fancybox4: ['../include/js/front-end/src/Entries/Fancybox4.js'],
14 featherlight: ['../include/js/front-end/src/Entries/Featherlight.js'],
15 glightbox: ['../include/js/front-end/src/Entries/GLightbox.js'],
16 imagelightbox: ['../include/js/front-end/src/Entries/ImageLightbox.js'],
17 lightcase: ['../include/js/front-end/src/Entries/Lightcase.js'],
18 lightgallery: ['../include/js/front-end/src/Entries/LightGallery.js'],
19 magnific: ['../include/js/front-end/src/Entries/Magnific.js'],
20 none: ['../include/js/front-end/src/Entries/None.js'],
21 photoswipe: ['../include/js/front-end/src/Entries/PhotoSwipe.js'],
22 photoswipe5: ['../include/js/front-end/src/Entries/PhotoSwipe5.js'],
23 prettyphoto: ['../include/js/front-end/src/Entries/PrettyPhoto.js'],
24 spotlight: ['../include/js/front-end/src/Entries/Spotlight.js'],
25 strip: ['../include/js/front-end/src/Entries/Strip.js'],
26 swipebox: ['../include/js/front-end/src/Entries/Swipebox.js'],
27 thickbox: ['../include/js/front-end/src/Entries/Thickbox.js'],
28 venobox: ['../include/js/front-end/src/Entries/VenoBox.js'],
29 }
30 };
31
32 const esmEntryPoints = {
33 /*
34 esm: {
35 photoswipe5: ['../include/js/front-end/src/Entries/PhotoSwipe5.js'],
36 }
37 */
38 };
39
40 const toImport = ['baguettebox', 'photoswipe', 'spotlight'];
41 const toIgnore = ['none', 'fancybox2', 'thickbox'];
42
43 // Plugins
44 const plugins = [
45 // "@babel/plugin-transform-arrow-functions",
46 "@babel/plugin-transform-async-to-generator",
47 "@babel/plugin-transform-modules-commonjs",
48 "@babel/plugin-transform-runtime",
49 "@babel/plugin-proposal-class-properties",
50 "@babel/plugin-syntax-class-properties"
51 ];
52
53 const providerPlugins = {};
54 providerPlugins['solo'] = {};
55 providerPlugins['solo-slider'] = {
56 Splide: '../../../../ext/splide/splide.js',
57 };
58 providerPlugins['combo'] = {
59 baguetteBox: '../../../../ext/baguettebox/baguettebox.js',
60 BigPicture: '../../../../ext/bigpicture/bigpicture.js',
61 GLightbox: '../../../../ext/glightbox/glightbox.js',
62 PhotoSwipe: '../../../../ext/photoswipe/photoswipe.js',
63 PhotoSwipeUI_Default: '../../../../ext/photoswipe/photoswipe-ui-default.js',
64 Spotlight: '../../../../ext/spotlight/spotlight.js',
65 };
66 providerPlugins['combo-slider'] = {... providerPlugins['combo']};
67 providerPlugins['combo-slider'].Splide = '../../../../ext/splide/splide.js';
68
69 const moduleTypes = [
70 {
71 type: 'es8',
72 module: {
73 rules: [{
74 test: /\.js$/, // Look for any .js files.
75 // exclude: /node_modules/, // Exclude the node_modules folder.
76 // Use babel loader to transpile the JS files.
77 use: {
78 loader: 'babel-loader',
79 options: {
80 presets: [
81 ["@babel/preset-env", {
82 targets: {
83 esmodules: true
84 },
85 // useBuiltIns: "entry"
86 }]
87 ],
88 plugins: plugins
89 }
90 }
91 }],
92 },
93 folder: 'out',
94 target: 'es8',
95 }
96 ];
97
98 const environments = [
99 {
100 type: 'dev',
101 mode: 'development',
102 extension: '',
103 // sourceMap: 'source-map',
104 sourceMap: false,
105 },
106 {
107 type: 'prod',
108 mode: 'production',
109 extension: '.min',
110 sourceMap: false,
111 }
112 ];
113
114 /**
115 * For each lightbox, we generate ES8 files that combine the Photonic scripts. The lightbox and slider scripts are excluded from this.
116 *
117 * The DEV file is unminified, while the PROD file is minified.
118 *
119 */
120 const config = [];
121 Object.entries(entryPoints).forEach(([combination, entry]) => {
122 moduleTypes.forEach((module) => {
123 environments.forEach((env) => {
124 // Configuration object
125 // - entry: Lists all entry points
126 // - output: Generates an output file per entry
127 // - .filename: [name] uses an object key from "entry" as a file name
128 // - .path: Specifies where the file should be written
129 config.push({
130 name: module.type + '-' + env.type + '-' + combination,
131 mode: env.mode,
132 devtool: env.sourceMap,// 'source-map',
133 entry: entry,
134 module: module.module,
135 target: module.target,
136 output: {
137 filename: 'photonic-[name]' + env.extension + '.js',
138 path: path.join(__dirname, '/../include/js/front-end/' + module.folder)
139 },
140 plugins: [
141 // new webpack.ProvidePlugin(providerPlugins[combination]),
142 ],
143 externals: {
144 jquery: 'jQuery',
145 },
146 });
147 });
148 });
149 });
150
151 Object.entries(esmEntryPoints).forEach(([combination, entry]) => {
152 moduleTypes.forEach((module) => {
153 environments.forEach((env) => {
154 config.push({
155 name: module.type + '-' + env.type + '-' + combination,
156 mode: env.mode,
157 devtool: env.sourceMap,// 'source-map',
158 entry: entry,
159 module: module.module,
160 target: module.target,
161 output: {
162 filename: 'photonic-[name]' + env.extension + '.js',
163 path: path.join(__dirname, '/../include/js/front-end/' + module.folder),
164 },
165 resolve: {
166 alias: {
167 "photoswipe": '/../include/ext/photoswipe5/photoswipe5.js',
168 "photoswipeLightbox": '/../include/ext/photoswipe5/photoswipe5-lightbox.js',
169 }
170 },
171 });
172 });
173 });
174 });
175
176 // Export the config object.
177 module.exports = config;
178