This repository was archived by the owner on Oct 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathwebpack.config.js
91 lines (82 loc) · 1.82 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
const path = require( "path" );
const webpack = require( "webpack" );
const CaseSensitivePathsPlugin = require( "case-sensitive-paths-webpack-plugin" );
const PORT = 3333;
module.exports = {
devtool: "cheap-module-eval-source-map",
entry: [
// Polyfill
"babel-polyfill",
// Compile the @yoast/configuration-wizard scss
"@yoast/components/src/configuration-wizard/configuration-wizard.css",
// Compile the yoast-components standalone .scss
"yoast-components/css/standalone.scss",
// Bundle the client for webpack-dev-server
// And connect to the provided endpoint
`webpack-dev-server/client?http://localhost:${PORT}`,
// Bundle the client for hot reloading
// 'Only-' means to only hot reload for successful updates
"webpack/hot/only-dev-server",
// Yoast components entry
"./render.js",
],
output: {
path: path.resolve( __dirname ),
filename: "index.js",
},
devServer: {
inline: true,
host: "0.0.0.0",
disableHostCheck: true,
port: PORT,
historyApiFallback: true,
hot: true,
contentBase: "./",
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules[/\\](?!(yoastseo)|(yoast-components)[/\\]).*/,
use: [ {
loader: "babel-loader",
options: {
presets: [
[ "es2015",
{ modules: false },
] ],
env: {
development: {
plugins: [
"babel-plugin-styled-components",
],
},
production: {},
},
},
} ],
},
{
test: /\.s?css$/,
use: [
{
loader: 'style-loader',
options: {
insertAt: 'top'
}
},
'css-loader',
'sass-loader',
]
},
],
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(),
new CaseSensitivePathsPlugin(),
],
resolve: {
extensions: [ ".json", ".jsx", ".js" ],
},
};