That's why you need to use something like a switch statement to make sure that you declare your split points on a route-by-route basis. That works great if you pass in a single file, but when you use a variable, it might end up bundling up your entire view folder. Loaders: [ Įach time you use the AMD-style require() or require.ensure() webpack will see what you passed in there and go and create a bundle with every possible match. This is super easy to setup in webpack by adding the following to your config: Require.js could usually infer this based on the tag you used to set it up or you might have configured it using the baseUrl option. The first thing you need to do is tell webpack where your JS files are. The enormous paths list in our require.js config.Tell webpack where you keep your JS files.In practice for us this meant addressing three areas: The first thing you do when you're converting from require.js to webpack is you take your whole require.js configuration file and convert it to a file. ![]() Despite the clear benefits in developer experience (DX) the setup was fairly difficult and I'd like to cover some of the challanges we faced to make the transition a bit easier. ![]() Here I'll instead talk about some of the technical challenges that we faced during the migration. In that post I talked about 3 main reasons for moving from require.js to webpack: This is the follow up to a post I wrote recently called From Require.js to Webpack - Party 1 (the why) which was published in my personal blog.
0 Comments
Leave a Reply. |