-
Notifications
You must be signed in to change notification settings - Fork 22
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
[QUESTION] Is assets-webpack-plugin compatible with minipack? #36
Comments
I see that the manifest format is different. There is a Or I could also try to create a PR to provide additional support for this type of format, would you be willing to accept that? I have no experience yet in developing ruby gems, but I'm willing to try. Lastly, I could just change my dependency from I wouldn't have this problem if I just read your blog earlier 😅 |
The naive implementation of the first option I mentioned was easier than I thought, I added the flatten function to convert the json schema from {
processOutput: function processOutput(assets) {
function sortObject(object) {
var sortedObj = {},
keys = Object.keys(object);
keys.sort(function (key1, key2) {
(key1 = key1.toLowerCase()), (key2 = key2.toLowerCase());
if (key1 < key2) return -1;
if (key1 > key2) return 1;
return 0;
});
for (var index in keys) {
var key = keys[index];
if (typeof object[key] == "object" && !(object[key] instanceof Array)) {
sortedObj[key] = sortObject(object[key]);
} else {
sortedObj[key] = object[key];
}
}
return sortedObj;
}
function flatten(assets) {
let flattenedAssets = Object.create(null, {});
for (const namespace in assets) {
if (namespace == "") {
// const limbo = flatten(assets[namespace])
// flattenedAssets = { ...flattenedAssets, ...limbo }
// TODO: Implement
continue;
}
for (const extension in assets[namespace]) {
flattenedAssets[`${namespace}.${extension}`] =
assets[namespace][extension];
}
}
return flattenedAssets;
}
const sortedAssets = sortObject(assets);
const flattenedAssets = flatten(sortedAssets);
return JSON.stringify(flattenedAssets, null, 2);
}
} |
I just read your blog and would have loved to have read it one week ago, before I started implementing my own implementation. I see that either
webpack-manifest-plugin
orwebpack-assets-manifest
are supported.I too did not like depending on yarn which webpacker forced you to. I saw this comment and installed
assets-webpack-plugin
. It even has a rails integration guide, with a super minimalist helper function:My question is, will assets-webpack-plugin work out of the box with minipack? The manifest.json file it outputs looks like this:
The text was updated successfully, but these errors were encountered: