In my entry.js file, I import a lot of js files like so:
import {airplane} from "./path/to/airplane.js"
In airplane.js
, which uses ThreeJS, there are some file imports such as:
OBJLoader().load("./path/to/object.obj");
My webpack config file is arranged like so:
module.exports = {
entry: "./path/to/entry.js",
module: {
rules: [
{
test: /.*.obj$/i,
type: "asset/source"
},
],
},
output: {
filename: "bundle.js",
path: path.resolve(__dirname, "dist"),
},
};
Is it possible for Webpack to load the content of object.obj
using asset/source or asset/resource?
For context, I am doing this to bundle everything into one bundle.js
file so no file paths are needed. Additionally, I don’t always know the path to object.obj
, so a wildcard filepath would be nice. Thanks in advance!