I'm working on updating an application so it is more maintainable. This application currently uses a very large JS file with many JS classes. I have separate the code so each JS class is in its own JS file.
I would like to use Parcel to combine all JS files into a single JS file I can link to from my index.html
.
I have added export default
to each main class. Eg. export default class MyJSClass
. Then I import classes as needed from index.js
file such as import MyJSClass from './MyJSClass.js';
The application I'm updating uses framework with structure below:
resources
|-Public
|-JS
|-singleHugeJSFile.js
|-Templates
|-index.html
I want to use Parcel and keep the same structure such as
resources
|-Public
|-JS
|-index.js // Entry point JS file
|-MyJSClass.js
|-SomeOtherClass.js
|-AnotherClass.js
...
|-Templates
|-index.html
I have install Parcel on resources dir and run:
parcel build public/js/index.js
However this generate files on dist dir.
How can I generate a single entry JS file containing all the JS using Parcel and keep the same structure of the application so I can continue using default path to link to this JS from index.html?