-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
refactor: change import for webpack v5 | not ready #169
Conversation
@martinoppitz Thank you for having a go at this, much appreciated! I see this is not ready but I'll make two initial comments:
|
4c14f08
to
ee8e8d3
Compare
Hello @jods4, in my first commit I focused on v5 upgrade. Now I reset my v4 changes and pushed it again. Now we must look at the iterator problem. |
Hi @jods4 and @EisenbergEffect, in the plugin an internal webpack.d.ts file is used instead of the one from webpack itself. there seem to be some changes here that i can't fix on my own. |
@martinoppitz I wrote that .d.ts file to augment the public one. These definitions are almost guaranteed to not be in sync with the Webpack 5. |
Hello @jods4. unfortunately i don't have time to get the webpack plugin running. We must upgrade webpack to v5. Because a lot of plugins only support webpack v5 in the future. Do you already have a plan? |
I started investigating here and used the changes from this PR as base. I changed the code of
There is no |
@ckotzbauer Hard to say from this error stack but have you tried changing the default options? |
I explicitly set this.options = Object.assign({
includeAll: <false>false,
aureliaConfig: ["standard", "developmentLogging"],
dist: "native-modules",
features: { },
moduleMethods: [],
noHtmlLoader: false,
// Undocumented safety switch
noInlineView: false,
noModulePathResolve: false,
noWebpackLoader: false,
// Ideally we would like _not_ to process conventions in node_modules,
// because they should be using @useView and not rely in convention in
// the first place. Unfortunately at this point many libs do use conventions
// so it's just more helpful for users to process them.
// As unlikely as it may seem, a common offender here is tslib, which has
// matching (yet unrelated) html files in its distribution. So I am making
// a quick exception for that.
viewsFor: "**/!(tslib)*.{ts,js}",
viewsExtensions: ".html",
},
options); |
@ckotzbauer, Can you please post the changes you have done to |
Of course @gowrav-scienaptic 👍 PreserveExportsPlugin.ts for (let module of modules) {
+ for (let dep of module.dependencies) {
- for (let reason of module.reasons) {
- let dep = reason.dependency;
let imports = dep[dependencyImports];
if (!imports) continue;
let set = getModuleExports(module);
for (let e of imports)
set.add(e);
}
} PreserveModuleNamePlugin.ts function getPreservedModules(modules: Webpack.Module[]) {
return new Set(
modules.filter(m => {
// Some modules might have [preserveModuleName] already set, see ConventionDependenciesPlugin.
let value = m[preserveModuleName];
+ for (let d of m.dependencies) {
+ if (!d || !d[preserveModuleName]) continue;
- for (let r of m.reasons) {
- if (!r.dependency || !r.dependency[preserveModuleName]) continue;
value = true;
+ let req = removeLoaders((d as ModuleDependency).request);
- let req = removeLoaders((r.dependency as ModuleDependency).request);
// We try to find an absolute string and set that as the module [preserveModuleName], as it's the best id.
if (req && !req.startsWith(".")) {
m[preserveModuleName] = req;
return true;
}
}
return !!value;
})
);
} |
I have exactly the same error, but I have the default |
|
Should |
I have done some searching and (possibly) found a solution/workaround for the removal of module.reasons in this comment.
Update 1: I have fooled around a bit with the source, but I'm not educated enough in how Webpack works exactly to work this out. Update 2: In #166 bigopon is working on supporting webpack 5 the proper way. I suspect this PR will become unnecessary. |
Here is my current draft for the needed changes: #170. The work needed for all the plugins is listed in 3 simple parts for now: typings & code & comments. Overtime, more details will be filled in. Will update my progress there as I continue the refactoring. |
Its done ... #170 |
No description provided.