You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: site/content/docs/5.3/getting-started/webpack.md
+9-2
Original file line number
Diff line number
Diff line change
@@ -81,6 +81,7 @@ With dependencies installed and our project folder ready for us to start coding,
81
81
constpath=require('path')
82
82
83
83
module.exports= {
84
+
mode:'development',
84
85
entry:'./src/js/main.js',
85
86
output: {
86
87
filename:'main.js',
@@ -116,13 +117,14 @@ With dependencies installed and our project folder ready for us to start coding,
116
117
117
118
We're including a little bit of Bootstrap styling here with the `div class="container"` and `<button>` so that we see when Bootstrap's CSS is loaded by Webpack.
118
119
119
-
3.**Now we need an npm script to run Webpack.** Open `package.json` and add the `start` script shown below (you should already have the test script). We'll use this script to start our local Webpack dev server.
120
+
3.**Now we need an npm script to run Webpack.** Open `package.json` and add the `start` script shown below (you should already have the test script). We'll use this script to start our local Webpack dev server. You can also add a `build` script shown below to build your project.
120
121
121
122
```json
122
123
{
123
124
// ...
124
125
"scripts": {
125
-
"start": "webpack serve --mode development",
126
+
"start": "webpack serve",
127
+
"build": "webpack build",
126
128
"test": "echo \"Error: no test specified\" && exit 1"
127
129
},
128
130
// ...
@@ -149,6 +151,7 @@ Importing Bootstrap into Webpack requires the loaders we installed in the first
149
151
constpath=require('path')
150
152
151
153
module.exports= {
154
+
mode:'development',
152
155
entry:'./src/js/main.js',
153
156
output: {
154
157
filename:'main.js',
@@ -165,12 +168,15 @@ Importing Bootstrap into Webpack requires the loaders we installed in the first
165
168
test:/\.(scss)$/,
166
169
use: [
167
170
{
171
+
// Adds CSS to the DOM by injecting a `<style>` tag
168
172
loader:'style-loader'
169
173
},
170
174
{
175
+
// Interprets `@import` and `url()` like `import/require()` and will resolve them
171
176
loader:'css-loader'
172
177
},
173
178
{
179
+
// Loader for webpack to process CSS with PostCSS
174
180
loader:'postcss-loader',
175
181
options: {
176
182
postcssOptions: {
@@ -181,6 +187,7 @@ Importing Bootstrap into Webpack requires the loaders we installed in the first
0 commit comments