-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack-config.js
55 lines (44 loc) · 1.09 KB
/
webpack-config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
'use srtict';
// Require path.
const path = require( 'path' );
// Configuration object.
const config = {
// Create the entry points.
// One for frontend and one for the admin area.
entry: {
videoPostType: './src/js/videoPostType.js',
shortcodeIframe: './src/js/shortcodeIframe.js'
},
// Create the output files.
// One for each of our entry points.
output: {
// [name] allows for the entry object keys to be used as file names.
filename: 'js/[name].js',
// Specify the path to the JS files.
path: path.resolve( __dirname, 'dist' )
},
// Setup a loader to transpile down the latest and great JavaScript so older browsers
// can understand it.
module: {
rules: [
{
// Look for any .js files.
test: /\.js$/,
// Exclude the node_modules folder.
exclude: /node_modules/,
// Use babel loader to transpile the JS files.
loader: 'babel-loader'
},
{
test: /\.css$/,
use: [ 'style-loader', 'css-loader' ]
},
{
test: /\.(png|svg|jpg|gif)$/,
use: [ 'file-loader' ]
}
]
}
};
// Export the config object.
module.exports = config;