Repo for testing webpack config settings on a very simple project
from website https://webpack.js.org/guides/asset-management/
// todo: 0. why isn't minification working? Probably something to do with babel. Do tutorial. Use example of it working here https://developers.google.com/web/fundamentals/performance/optimizing-javascript/tree-shaking/
- turn webpack config file into typescript
- learn babel config, how to use typescript with babel-loader instead of ts-loader. What does .babelrc do?
- What does modernizr-loader and post-css loader do?
- how does SSR work? Investigate nextJS
- how to get CSS modules working?
- are node_modules libraries exported as already polyfilled?
- how does the lock file work? how does the npm dependency tree work?
Notes / things learned:
- Tree shaking only works when minification happens
- This branch is setup to show the output so you can test different options. Webpack-dev-server stores the files in a temp folder which you can't view. In real life, you would use webpackDevServer.
- Can use (browserList)[https://www.npmjs.com/package/browserslist] npm package to specify what environments you want to target in one place
- You don't need ts-loader for webpack, babel can do it and is more configurable
- PostCss is a webpack css loader that can do things like auto-prefix css values so that they work in non-supported browsers
- We're now using babel-plugin-lodash to cherry pick the lodash modules we want, and we have moved the babel config to be inside the webpackConfig.ts file