In our project structure, we have a directory containing several files js. We can add or remove any of these files later. Currently there is main.jsone in which we import each file and create a map (file name as a key and a class defined in the file as a value).
Example:
Validator1.js
class Validator1 {
constructor() {
this.payRegex = /^[0-9][0-9][0-9]\/[A-Z,0-9][A-Z,0-9]*$/;
}
validate(obj) {
}
}
export default Validator1;
In main.js
import Validator1 from 'validator1.js';
import NoopValidator from './noop.js';
var validatorMap = {};
validatorMap['validator1'] = new Validator1;
validatorMap['DEFAULT'] = new NoopValidator;
We provide this file for the browser to create bundle.js. Now that I said that there are several files in this folder, and we want to generate this file at compile time using maven.
- Is there any way besides creating a maven plugin for this?
- We are using EMAScript6