-
Notifications
You must be signed in to change notification settings - Fork 2k
src gui webpack_attempts
KernelDeimos edited this page Feb 25, 2025
·
1 revision
Multiple things attempted when trying to add icons to the bundle.
None of this worked - eventually just prepended text on emit instead.
// compilation.hooks.processAssets.tap(
// {
// name: 'AddImportPlugin',
// stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,
// },
// (assets) => {
// for (const assetName of Object.keys(assets)) {
// if (assetName.endsWith('.js')) {
// const source = assets[assetName].source();
// const newSource = `${icons}\n${source}`;
// compilation.updateAsset(assetName, new compiler.webpack.sources.RawSource(newSource));
// }
// }
// }
// );
// Inject into bundle
// console.log('adding this:' + icons);
// compilation.assets['icons-thing'] = {
// source: () => icons,
// size: () => icons.length,
// };
// compilation.addModule({
// identifier() {
// return 'icons-thing';
// },
// build() {
// this._source = {
// source() {
// return content;
// },
// size() {
// return content.length;
// }
// };
// }
// });
// Add the generated module to Webpack's internal modules
// compilation.hooks.optimizeModules.tap('IconsPlugin', (modules) => {
// const virtualModule = {
// identifier: () => 'icons.js',
// readableIdentifier: () => 'icons.js',
// build: () => {},
// source: () => icons,
// size: () => icons.length,
// chunks: [],
// assets: [],
// hash: () => 'icons',
// };
// modules.push(virtualModule);
// });
});
// this.hooks.entryOption.tap('IconsPlugin', (context, entry) => {
// entry.main.import.push('icons-thing');
// });
// this.hooks.make.tapAsync('InjectTextEntryPlugin', (compilation, callback) => {
// // Create a new asset (fake module) from the generated content
// const content = `console.log('${this.options.text}');`;
// callback();
// });
// this.hooks.entryOption.tap('IconsPlugin', (context, entry) => {
// });
// this.hooks.entryOption.tap('InjectTextEntryPlugin', (context, entry) => {
// // Add this as an additional entry point
// this.options.entry = {
// ...this.options.entry,
// 'generated-entry': '// FINDME\n'
// };
// });
This wiki is generated from the repository. Do not edit files the wiki.
You are reading documentation for Puter, an open-source high-level operating system.
Getting started with Puter on localhost is as simple as:
git clone https://github.com/HeyPuter/puter.git
npm install
npm run start