-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid configuration object - configuration.resolve.plugins[0] misses the property 'apply' #68
Comments
@themaskedavenger what version of the plugin are you using? @Brian-McBride perhaps you can take look at this if it is something that should be supported by your PR? |
Thanks for the quick response! Currently using version |
Webpack 5 has some seriously screwed-up typing. Apply is in the class. Maybe, there is a case where the plugin didn't create an instance properly and the error was in a try/catch without any output. It could just be that TsconfigPathPlugin didn't get constructed. Also, in your code, you have You can set up a test like this and see what is up. I should really check to see if someone wrote a good webpack testing library. it(`Test to ensure Apply exists and is working`, async (done) => {
const webpackSettings: Configuration = {
entry: `${__dirname}/../../example/src/index.ts`,
target: "web",
output: {
path: path.join(__dirname, "../../temp"),
filename: "[name].js",
},
mode: "development",
resolve: {
extensions: [
".ts",
".tsx",
".js",
".jsx",
"ttf",
"eot",
"otf",
"svg",
"png",
"woff",
"woff2",
],
plugins: [
new TsconfigPathsPlugin({
configFile: `${__dirname}/../../example/tsconfig.json`,
}),
],
},
module: {
rules: [],
},
};
// Build compiler
const compiler = webpack(webpackSettings);
const pluginInstance = compiler?.options?.resolve?.plugins?.find(
(plugin) => plugin instanceof TsconfigPathsPlugin
);
if (!pluginInstance) {
return done(`TsconfigPathsPlugin not loaded in webpack settings`);
}
expect(pluginInstance instanceof TsconfigPathsPlugin).toBeTruthy();
expect((pluginInstance as TsconfigPathsPlugin).apply).toBeDefined();
inspect(pluginInstance, false, 5, true);
// Run compiler
compiler.run((err, stats) => {
if (err) {
done(err);
return;
}
expect(stats).toBeDefined();
const details = stats?.toJson();
expect(details?.errorsCount).toEqual(0);
done();
});
}); |
When adding the webpack plugin, I'm getting an error saying:
Using Webpack 5.24.4
webpack config:
Similar to #61, except it is stopping Webpack from compiling.
Note: am using typescript and manually calling webpack, so importing the plugin like:
import TsConfigPathsPlugin from 'tsconfig-paths-webpack-plugin';
. When I inspect the object created byconst p = new TsConfigPathsPlugin()
, it doesn't have anapply
method, although I can evaluate andp.apply
returns a function.The text was updated successfully, but these errors were encountered: