Git Product home page Git Product logo

Browser scripts cannot have imports or exports. Use a <script type="module"> instead about browser-extension-template HOT 5 CLOSED

fregante avatar fregante commented on May 31, 2024
Browser scripts cannot have imports or exports. Use a

Comments (5)

fregante avatar fregante commented on May 31, 2024 8

I saw this issue today too. It's possible that Parcel released another breaking change a usual.

Try adding a type="module" attribute on the script tag

from browser-extension-template.

prokher avatar prokher commented on May 31, 2024 4

@fregante, thank you, adding type="module" did the trick:

$ git diff
diff --git a/source/options.html b/source/options.html
index 40894b3..57cb974 100644
--- a/source/options.html
+++ b/source/options.html
@@ -28,4 +28,4 @@
        </div>
 </form>

-<script src="options.js"></script>
+<script type="module" src="options.js"></script>
$ npm run build

> build
> parcel build source/manifest.json --no-content-hash --no-source-maps --dist-dir distribution --no-cache --detailed-report 0

✨ Built in 2.34s

distribution/manifest.json              633 B     39ms
distribution/icon.png                 1.14 KB     60ms
distribution/background.js           30.88 KB    511ms
distribution/options.html               925 B    617ms
distribution/options.9515e12b.css       616 B    1.28s
distribution/options.81ccf7e2.js     53.22 KB    727ms

from browser-extension-template.

prokher avatar prokher commented on May 31, 2024

Here is a pull request #52.

from browser-extension-template.

wll8 avatar wll8 commented on May 31, 2024

If this is caused by an update, I did not upgrade any packages, and I still received this error, which brought a lot of unnecessary trouble to the developers and brought great uncertainty to the stability of the project!

from browser-extension-template.

wll8 avatar wll8 commented on May 31, 2024

If this is caused by an update, I did not upgrade any packages, and I still received this error, which brought a lot of unnecessary trouble to the developers and brought great uncertainty to the stability of the project!

from browser-extension-template.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.