Comments (9)
No problem, you will excuse me for my bad English sprinkled with Google translation.
To start dll_vendor.js is just HappyPack, which allows to significantly reduce the first build time when doing a npm run dev
.
It is only enabled for development and created a dll from this config file (webpack/vendor.config.js#L61L77). If you need you can add a package to the list and do a npm run build-dlls
This allows not to rebuild the packages listed in the config.
For the splitting code it is very simple: with webpack 2 it is enough to add a System.import (return a promise) to load a resource only when it is required and all those that it include if they are not already included elsewhere in the initial bundle.
Recently with react-router it is possible to pass a promise (react-router#3719) to a getComponent props to do dynamic routing. (cf: src/routes.js)
If you want to add a route to lazy loading you will need to remove the container from container/index.js, and all components that it includes from components/index.js.
from react-redux-universal-hot-example.
You can not index a file that is meant to be in a chunk, that would connect it to the main bundle.
I do not see how it would be possible to get around this, if someone has an idea.
from react-redux-universal-hot-example.
ok thanks looks great. what if I need to load a specific file file1.js from domain.com/js/file1.js for route1 and route2 while route3, route3, route5 does not need that file.
from react-redux-universal-hot-example.
Just as I described above, webpack should do its job.
from react-redux-universal-hot-example.
@bertho-zero I appreciate your explanation! But I have another question, doesn't doing so will eliminate the handy way of importing components/containers by just using
import { ContainerName } from 'containers'
?
Because by removing necessary containers export from containers/index.js
we also can't import it directly using resolved path 'containers'
from other components, because the module is simply not exported and not there. I appreciate the answer.
from react-redux-universal-hot-example.
You didnt need to import it before with import { ContainerName } from 'containers', as you are importing directly here <Route path="path123" getComponent={() => System.import('./containers/ContainerName')}/>
from react-redux-universal-hot-example.
@Swapnilchavan18 Thank you for the reply. No, I mean in the current containers, say, src/containers/About/About.js, it uses resolved path components/MiniInfoBar/MiniInfoBar
. I want to include other containers inside my container and I can't use the resolved path because then it will be included in the main.js
(I tried this). Hence, no code splitting. Is there any workaround?
from react-redux-universal-hot-example.
@bertho-zero when i used webpack 2.2 and System.import inside src/route.js file.
it gives eslint error 'System' is not defined no-undef.
than i added exception in .eslintrc file "no-undef": 0 in rules
Now i am getting new error ./~/browserify-sign/browser/algorithms.json
/var/www/projectfolder/node_modules/browserify-sign/browser/algorithms.json Unexpected token (2:27)
You may need an appropriate loader to handle this file type.
finally solved it by adding json-loader in webpack rules
{ test: /.json$/, use: [ 'json-loader' ] }
from react-redux-universal-hot-example.
@bertho-zero when i use webpack 2 and System.import syntax in getComponent prop of Route component inside /src/route.js
it loads component when its in browser but after component is loaded when browser tab is refreshed, server is not able to load component on Server side and hence server is not able to response.
It does not give any error just page request get timeout.
from react-redux-universal-hot-example.
Related Issues (20)
- An in-range update of eslint-plugin-react is breaking the build 🚨 HOT 3
- An in-range update of @babel/runtime-corejs3 is breaking the build 🚨 HOT 3
- An in-range update of babel7 is breaking the build 🚨 HOT 2
- An in-range update of final-form is breaking the build 🚨 HOT 5
- An in-range update of webpack is breaking the build 🚨 HOT 18
- An in-range update of eslint-plugin-react is breaking the build 🚨 HOT 8
- issues updating bootstrap 3 to bootstrap 4
- Failing to send authentication credentials to custom API HOT 1
- An in-range update of js-cookie is breaking the build 🚨 HOT 1
- Chrome caches API requests when nginx is set as reversed proxy HOT 2
- An in-range update of react-redux is breaking the build 🚨 HOT 4
- An in-range update of history is breaking the build 🚨 HOT 2
- An in-range update of @babel/runtime-corejs3 is breaking the build 🚨 HOT 10
- An in-range update of babel7 is breaking the build 🚨
- An in-range update of babel7 is breaking the build 🚨 HOT 33
- An in-range update of core-js is breaking the build 🚨 HOT 5
- Using bootstrap 4 and dependencies outdated
- Running Tests - Mocha on the Backend - Feathers Sequelize
- Update HOT 2
- Authentication Pattern HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-redux-universal-hot-example.