in the context of aws lambda functions i currenlty need to access certain files in their runtime, for this i included this function below which will put a file that i import into the same folder importing the file.
const resolveWsdlInCurrentRuntime: Configuration['output']['assetModuleFilename'] = (pathData) => {
return join(dirname(pathData.runtime.toString()), '[path]', '[base]');
}
// ... Webpack config ...
module: {
rules: [
{ test: /.ts$/, loader: 'ts-loader', options: {transpileOnly: true} },
{
test: /.(wsdl|xml)$/,
type: 'asset/resource',
generator: {
filename: resolveWsdlInCurrentRuntime,
},
}
],
},
resolve: {
extensions: ['.js', '.ts'],
alias: {
wsdl: resolve(__dirname, 'wsdl'),
},
},
// ...
so when import like below it automaticaly puts the file in the same folder and i can access it
import 'wsdl/some.wsdl'
the problem i encounter now however is that when i do the import import 'wsdl/some.wsdl'
in two separate files the file will only be included in one of their outputs. Instead i would like for the file to be included each time i import it in a specific runtime.
does anyone have any idea how i can achieve this?