You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Parcel produces an invalid bundle in watch mode when importing a script of type="module" on a manifest version 2 extension page. The bundle works fine when building and using manifest version 3.
The bundle produced has an empty entry array and a null main entry. If I manually add those, the bundle works fine.
💁 Possible Solution
🔦 Context
💻 Code Sample
This is the bundled produced:
// modules are defined as an array// [ module function, map of requires ]//// map of requires is short require name -> numeric require//// anything defined in a previous bundle is accessed via the// orig method which is the require for previous bundles(function(modules,entry,mainEntry,parcelRequireName,globalName){/* eslint-disable no-undef */varglobalObject=typeofglobalThis!=="undefined"
? globalThis
: typeofself!=="undefined"
? self
: typeofwindow!=="undefined"
? window
: typeofglobal!=="undefined"
? global
: {};/* eslint-enable no-undef */// Save the require from previous bundle to this closure if anyvarpreviousRequire=typeofglobalObject[parcelRequireName]==="function"&&globalObject[parcelRequireName];varcache=previousRequire.cache||{};// Do not use `require` to prevent Webpack from trying to bundle this callvarnodeRequire=typeofmodule!=="undefined"&&typeofmodule.require==="function"&&module.require.bind(module);functionnewRequire(name,jumped){if(!cache[name]){if(!modules[name]){// if we cannot find the module within our internal map or// cache jump to the current global require ie. the last bundle// that was added to the page.varcurrentRequire=typeofglobalObject[parcelRequireName]==="function"&&globalObject[parcelRequireName];if(!jumped&¤tRequire){returncurrentRequire(name,true);}// If there are other bundles on this page the require from the// previous one is saved to 'previousRequire'. Repeat this as// many times as there are bundles until the module is found or// we exhaust the require chain.if(previousRequire){returnpreviousRequire(name,true);}// Try the node require function if it exists.if(nodeRequire&&typeofname==="string"){returnnodeRequire(name);}varerr=newError("Cannot find module '"+name+"'");err.code="MODULE_NOT_FOUND";throwerr;}localRequire.resolve=resolve;localRequire.cache={};varmodule=(cache[name]=newnewRequire.Module(name));modules[name][0].call(module.exports,localRequire,module,module.exports,globalObject);}returncache[name].exports;functionlocalRequire(x){varres=localRequire.resolve(x);returnres===false ? {} : newRequire(res);}functionresolve(x){varid=modules[name][1][x];returnid!=null ? id : x;}}functionModule(moduleName){this.id=moduleName;this.bundle=newRequire;this.exports={};}newRequire.isParcelRequire=true;newRequire.Module=Module;newRequire.modules=modules;newRequire.cache=cache;newRequire.parent=previousRequire;newRequire.register=function(id,exports){modules[id]=[function(require,module){module.exports=exports;},{},];};Object.defineProperty(newRequire,"root",{get: function(){returnglobalObject[parcelRequireName];},});globalObject[parcelRequireName]=newRequire;for(vari=0;i<entry.length;i++){newRequire(entry[i]);}if(mainEntry){// Expose entry point to Node, AMD or browser globals// Based on https://github.com/ForbesLindesay/umd/blob/master/template.jsvarmainExports=newRequire(mainEntry);// CommonJSif(typeofexports==="object"&&typeofmodule!=="undefined"){module.exports=mainExports;// RequireJS}elseif(typeofdefine==="function"&&define.amd){define(function(){returnmainExports;});// <script>}elseif(globalName){this[globalName]=mainExports;}}})({lmBGF: [function(require,module,exports,__globalThis){console.log("Hello world");},{},],},[],null,"parcelRequire94c2");
🌍 Your Environment
Software
Version(s)
Parcel
2.13.3
Node
20.17.0
npm/Yarn
npm 10.8.2
Operating System
macOS 15.3
The text was updated successfully, but these errors were encountered:
I already had "extends": "@parcel/config-webextension". Your configuration gives me an error @parcel/packager-ts: TS bundles must only contain one asset.
The extension itself builds fine. The problem is not with the background or content script. It is with a page that is included in the extension in which I import a script.
🐛 bug report
Parcel produces an invalid bundle in watch mode when importing a script of type="module" on a manifest version 2 extension page. The bundle works fine when building and using manifest version 3.
🎛 Configuration (.babelrc, package.json, cli command)
And the command used:
🤔 Expected Behavior
The bundle should work fine in watch mode.
😯 Current Behavior
The bundle produced has an empty entry array and a null main entry. If I manually add those, the bundle works fine.
💁 Possible Solution
🔦 Context
💻 Code Sample
This is the bundled produced:
🌍 Your Environment
The text was updated successfully, but these errors were encountered: