-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnotes
More file actions
39 lines (26 loc) · 1.69 KB
/
notes
File metadata and controls
39 lines (26 loc) · 1.69 KB
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
to skip npm init default settings pass as
npm init -y
to download next version of webpack
npm i webpack@next --save-dev
install webpack-cli, webpack-cli uses babel-preset-es2015 but this has to be upgraded to latest babel at babel-preset-env,
but we aren't adding babel-preset-es2015 manually to our dev dependencies but instead webpack-cli (3rd party) uses it,
to see which 3rd party library in our dependencies list uses a particular module ex: babel-preset-es2015, then do as:
npm ls babel-preset-es2015 07:29:39
webpack-v4-getting-started@1.0.0
└─┬ webpack-cli@2.0.4
└─┬ jscodeshift@0.4.0
└── babel-preset-es2015@6.24.1
running npm run build ($webpack) will throw
"ERROR in Entry module not found: Error: Can't resolve './src' in '/Users/buddhira/Desktop/work-h-p-hard/webpack-v4-getting-started'"
the eror briefly mentions that it cannot find './src',
the entry point is the file webpack looks for to start building your Javascript bundle.
prior to webpack-v4 ./src contains the config file and webpack by default looks for entry point there webpack.config.js file
but from v4, instead of config, it will take ./src/index.js as default file
!and no need of output file as well
!config less feature is something similar to "parcel"
create index.js under src/ and then run 'npm run build'
Prod and Development modes:
"dev": "webpack --mode development",
"prod": "webpack --mode production"
webpack 4 uses development and production mode (mode flag) to do different things depending on the env without any other usage of plugins like Uglify for minifying in production,
the production env does "Tree Shaking, Minifying, Scope hoisting etc"