I'm porting an old Dojo Toolkit application to newer technologies (Vue.js and WebPack).
My scenarios is...
Those new modules should work with old Dojo Loader or the new WebPack loader. I was able to remove most of dojo dependencies but I still need to use the plugins dojo/text (which loads a html file as a string) and dojo/i18n (which loads a module based on the locale) for the new components.
Those components are being prototyped on a WebPack application but on production it will still use Dojo Loader util all Dojo dependencies was removed.
I was able to configure WebPack to load the HTML when using dojo/text and the default language when using dojo/i18n using:
plugins: [
new webpack.NormalModuleReplacementPlugin(/^dojo\/text!/, function(data) {
data.request = data.request.replace(/^dojo\/text!/, '!html-loader!');
}),
new webpack.NormalModuleReplacementPlugin(/^dojo\/i18n!/, function(data) {
data.request = data.request.replace(/^dojo\/i18n!/, '');
})
]
The issue...
A typical i18n Dojo module for the default language is:
define({
root: {
placeholder: 'Name'
},
es: true,
pt: true
});
Dojo loader get only the root attribute as the module result:
define({
placeholder: 'Name'
});
The question is...
Can I load a module, parse or eval it and return just the root attribute as result, using a existing loader or plugin?
Making this module:
define({
root: {
placeholder: 'Name'
},
es: true,
pt: true
});
be transformed into
define({
placeholder: 'Name'
});