fooplugins /
foogallery
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | /** |
||
| 2 | * Webpack Configuration |
||
| 3 | * |
||
| 4 | * Working of a Webpack can be very simple or complex. This is an intenally simple |
||
| 5 | * build configuration. |
||
| 6 | * |
||
| 7 | * Webpack basics — If you are new the Webpack here's all you need to know: |
||
| 8 | * 1. Webpack is a module bundler. It bundles different JS modules together. |
||
| 9 | * 2. It needs and entry point and an ouput to process file(s) and bundle them. |
||
| 10 | * 3. By default it only understands common JavaScript but you can make it |
||
| 11 | * understand other formats by way of adding a Webpack loader. |
||
| 12 | * 4. In the file below you will find an entry point, an ouput, and a babel-loader |
||
| 13 | * that tests all .js files excluding the ones in node_modules to process the |
||
| 14 | * ESNext and make it compatible with older browsers i.e. it converts the |
||
| 15 | * ESNext (new standards of JavaScript) into old JavaScript through a loader |
||
| 16 | * by Babel. |
||
| 17 | * |
||
| 18 | * TODO: Instructions. |
||
| 19 | * |
||
| 20 | * @since 1.0.0 |
||
| 21 | */ |
||
| 22 | |||
| 23 | const paths = require( './paths' ); |
||
|
0 ignored issues
–
show
Backwards Compatibility
introduced
by
Loading history...
|
|||
| 24 | const webpack = require( 'webpack' ); |
||
|
0 ignored issues
–
show
|
|||
| 25 | const autoprefixer = require( 'autoprefixer' ); |
||
|
0 ignored issues
–
show
|
|||
| 26 | const ExtractTextPlugin = require( 'extract-text-webpack-plugin' ); |
||
|
0 ignored issues
–
show
|
|||
| 27 | |||
| 28 | // Source maps are resource heavy and can cause out of memory issue for large source files. |
||
| 29 | const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP === 'true'; |
||
|
0 ignored issues
–
show
|
|||
| 30 | |||
| 31 | // Extract style.css for both editor and frontend styles. |
||
| 32 | const blocksCSSPlugin = new ExtractTextPlugin( { |
||
|
0 ignored issues
–
show
|
|||
| 33 | filename: './gutenberg/dist/blocks.style.build.css', |
||
| 34 | } ); |
||
| 35 | |||
| 36 | // Extract editor.css for editor styles. |
||
| 37 | const editBlocksCSSPlugin = new ExtractTextPlugin( { |
||
|
0 ignored issues
–
show
|
|||
| 38 | filename: './gutenberg/dist/blocks.editor.build.css', |
||
| 39 | } ); |
||
| 40 | |||
| 41 | // Configuration for the ExtractTextPlugin — DRY rule. |
||
| 42 | const extractConfig = { |
||
|
0 ignored issues
–
show
|
|||
| 43 | use: [ |
||
| 44 | // "postcss" loader applies autoprefixer to our CSS. |
||
| 45 | { loader: 'raw-loader' }, |
||
| 46 | { |
||
| 47 | loader: 'postcss-loader', |
||
| 48 | options: { |
||
| 49 | ident: 'postcss', |
||
| 50 | plugins: [ |
||
| 51 | autoprefixer( { |
||
| 52 | browsers: [ |
||
| 53 | '>1%', |
||
| 54 | 'last 4 versions', |
||
| 55 | 'Firefox ESR', |
||
| 56 | 'not ie < 9', // React doesn't support IE8 anyway |
||
| 57 | ], |
||
| 58 | flexbox: 'no-2009', |
||
| 59 | } ), |
||
| 60 | ], |
||
| 61 | }, |
||
| 62 | }, |
||
| 63 | // "sass" loader converst SCSS to CSS. |
||
| 64 | { |
||
| 65 | loader: 'sass-loader', |
||
| 66 | options: { |
||
| 67 | // Add common CSS file for variables and mixins. |
||
| 68 | data: '@import "./gutenberg/src/common.scss";\n', |
||
| 69 | outputStyle: 'compressed', |
||
| 70 | }, |
||
| 71 | }, |
||
| 72 | ], |
||
| 73 | }; |
||
| 74 | |||
| 75 | // Export configuration. |
||
| 76 | module.exports = { |
||
| 77 | entry: { |
||
| 78 | './gutenberg/dist/blocks.build': paths.pluginBlocksJs, // 'name' : 'path/file.ext'. |
||
| 79 | }, |
||
| 80 | output: { |
||
| 81 | // Add /* filename */ comments to generated require()s in the output. |
||
| 82 | pathinfo: true, |
||
| 83 | // The dist folder. |
||
| 84 | path: paths.pluginDist, |
||
| 85 | filename: '[name].js', // [name] = './dist/blocks.build' as defined above. |
||
| 86 | }, |
||
| 87 | // You may want 'eval' instead if you prefer to see the compiled output in DevTools. |
||
| 88 | devtool: shouldUseSourceMap ? 'source-map' : false, |
||
| 89 | module: { |
||
| 90 | rules: [ |
||
| 91 | { |
||
| 92 | test: /\.(js|jsx|mjs)$/, |
||
| 93 | exclude: /(node_modules|bower_components)/, |
||
| 94 | use: { |
||
| 95 | loader: 'babel-loader', |
||
| 96 | options: { |
||
| 97 | |||
| 98 | // This is a feature of `babel-loader` for webpack (not Babel itself). |
||
| 99 | // It enables caching results in ./node_modules/.cache/babel-loader/ |
||
| 100 | // directory for faster rebuilds. |
||
| 101 | cacheDirectory: true, |
||
| 102 | }, |
||
| 103 | }, |
||
| 104 | }, |
||
| 105 | { |
||
| 106 | test: /style\.s?css$/, |
||
| 107 | exclude: /(node_modules|bower_components)/, |
||
| 108 | use: blocksCSSPlugin.extract( extractConfig ), |
||
| 109 | }, |
||
| 110 | { |
||
| 111 | test: /editor\.s?css$/, |
||
| 112 | exclude: /(node_modules|bower_components)/, |
||
| 113 | use: editBlocksCSSPlugin.extract( extractConfig ), |
||
| 114 | }, |
||
| 115 | ], |
||
| 116 | }, |
||
| 117 | // Add plugins. |
||
| 118 | plugins: [ |
||
| 119 | blocksCSSPlugin, |
||
| 120 | editBlocksCSSPlugin, |
||
| 121 | // Minify the code. |
||
| 122 | new webpack.optimize.UglifyJsPlugin( { |
||
| 123 | compress: { |
||
| 124 | warnings: false, |
||
| 125 | // Disabled because of an issue with Uglify breaking seemingly valid code: |
||
| 126 | // https://github.com/facebookincubator/create-react-app/issues/2376 |
||
| 127 | // Pending further investigation: |
||
| 128 | // https://github.com/mishoo/UglifyJS2/issues/2011 |
||
| 129 | comparisons: false, |
||
| 130 | }, |
||
| 131 | mangle: { |
||
| 132 | safari10: true, |
||
| 133 | }, |
||
| 134 | output: { |
||
| 135 | comments: false, |
||
| 136 | // Turned on because emoji and regex is not minified properly using default |
||
| 137 | // https://github.com/facebookincubator/create-react-app/issues/2488 |
||
| 138 | ascii_only: true, |
||
| 139 | }, |
||
| 140 | sourceMap: shouldUseSourceMap, |
||
| 141 | } ), |
||
| 142 | ], |
||
| 143 | stats: 'minimal', |
||
| 144 | // stats: 'errors-only', |
||
| 145 | // Add externals. |
||
| 146 | externals: { |
||
| 147 | react: 'React', |
||
| 148 | 'react-dom': 'ReactDOM', |
||
| 149 | ga: 'ga', // Old Google Analytics. |
||
| 150 | gtag: 'gtag', // New Google Analytics. |
||
| 151 | jquery: 'jQuery', // import $ from 'jquery' // Use the WordPress version. |
||
| 152 | }, |
||
| 153 | }; |
||
| 154 |