I am facing a challenge as I transition my angular 1 + typescript
project build setup from gulp to webpack
. The issue lies in bundling the node_modules js
files in the correct sequence.
Previously, I relied on bower for client-side dependencies, and the use of gulp's wiredep
plugin made it easy to determine the dependency order based on the
bower dependencies section + main section
.
Now with webpack, the approach is different. Rather than relying on specific dependency sections, imported modules play a crucial role in determining the order.
To make this work, I need to transfer all dependencies from bower.json to package.json.
Currently, with typings in use, tsc manages the typings automatically without requiring manual imports for bower packages.
If I understand correctly, to make it compatible with webpack,
a) Should I eliminate typings and directly import the js files within my ts files?
Given that npm js modules typically work with modules, do typings files become unnecessary for webpack?
OR
b) Should I create a separate vendor.ts file where I manually organize the import sequence (for js and css)?
This method may be more tedious compared to using wiredep, but it can enable bundling the vendor files separately using chunks-plugin.
OR
c) Is there another common approach to address this issue?
The transition of angular 1 from gulp to webpack proves to be a challenging task.