|
1 |
| -'use strict'; |
2 |
| -var webpack = require('webpack'); |
3 |
| -var fs = require('fs'); |
| 1 | +"use strict"; |
| 2 | +var webpack = require("webpack"); |
| 3 | +var fs = require("fs"); |
4 | 4 |
|
5 | 5 | // Builds example bundles
|
6 | 6 | module.exports = {
|
7 |
| - mode: 'development', |
| 7 | + mode: "development", |
8 | 8 | context: __dirname,
|
9 | 9 | entry: {
|
10 |
| - commons: ["lodash"], |
| 10 | + commons: ["lodash"] |
11 | 11 | },
|
12 | 12 | optimization: {
|
13 | 13 | splitChunks: {
|
14 | 14 | cacheGroups: {
|
15 | 15 | commons: {
|
16 |
| - name: 'commons', |
17 |
| - chunks: 'initial', |
| 16 | + name: "commons", |
| 17 | + chunks: "initial", |
18 | 18 | minChunks: 2
|
19 | 19 | }
|
20 | 20 | }
|
21 | 21 | }
|
22 | 22 | },
|
23 | 23 | output: {
|
24 |
| - path: __dirname + "/dist", |
25 |
| - filename: "[name].bundle.js", |
26 |
| - sourceMapFilename: "[file].map", |
| 24 | + path: __dirname + "/dist", |
| 25 | + filename: "[name].bundle.js", |
| 26 | + sourceMapFilename: "[file].map" |
27 | 27 | },
|
28 | 28 | module: {
|
29 | 29 | rules: [
|
30 |
| - {test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel-loader', query: { |
31 |
| - cacheDirectory: true, |
32 |
| - plugins: [ |
33 |
| - 'transform-react-inline-elements', |
34 |
| - 'transform-react-constant-elements', |
35 |
| - ] |
36 |
| - }} |
| 30 | + { |
| 31 | + test: /\.jsx?$/, |
| 32 | + exclude: /node_modules/, |
| 33 | + loader: "babel-loader", |
| 34 | + query: { |
| 35 | + cacheDirectory: true, |
| 36 | + plugins: [ |
| 37 | + "transform-react-inline-elements", |
| 38 | + "transform-react-constant-elements" |
| 39 | + ] |
| 40 | + } |
| 41 | + } |
37 | 42 | ]
|
38 | 43 | },
|
39 | 44 | plugins: [
|
40 | 45 | new webpack.DefinePlugin({
|
41 | 46 | "process.env": {
|
42 |
| - NODE_ENV: JSON.stringify('production') |
| 47 | + NODE_ENV: JSON.stringify("production") |
43 | 48 | }
|
44 |
| - }), |
| 49 | + }) |
45 | 50 | ],
|
46 | 51 | resolve: {
|
47 | 52 | extensions: [".webpack.js", ".web.js", ".js", ".jsx"],
|
48 |
| - alias: {'react-grid-layout': __dirname + '/index-dev.js'} |
| 53 | + alias: { "react-grid-layout": __dirname + "/index-dev.js" } |
49 | 54 | }
|
50 | 55 | };
|
51 | 56 |
|
52 | 57 | // Load all entry points
|
53 |
| -var files = fs.readdirSync(__dirname + '/test/examples').filter(function(element, index, array){ |
| 58 | +var files = fs |
| 59 | + .readdirSync(__dirname + "/test/examples") |
| 60 | + .filter(function(element, index, array) { |
54 | 61 | return element.match(/^.+\.jsx$/);
|
55 |
| -}); |
| 62 | + }); |
56 | 63 |
|
57 |
| -for(var idx in files){ |
58 |
| - var file = files[idx]; |
59 |
| - var module_name = file.replace(/\.jsx$/,''); |
60 |
| - module.exports.entry[module_name] = './test/examples/' + file; |
| 64 | +for (var idx in files) { |
| 65 | + var file = files[idx]; |
| 66 | + var module_name = file.replace(/\.jsx$/, ""); |
| 67 | + module.exports.entry[module_name] = "./test/examples/" + file; |
61 | 68 | }
|
0 commit comments