Coder Social home page Coder Social logo

Comments (11)

mubaidr avatar mubaidr commented on July 19, 2024

You are trying to use import statements in js file, which is causing issue. Also if you run pnpm dev and load extension in chrome, it will display better error messages (with source-maps).

from vite-vue3-chrome-extension-v3.

botshen avatar botshen commented on July 19, 2024

You are trying to use import statements in js file, which is causing issue. Also if you run pnpm dev and load extension in chrome, it will display better error messages (with source-maps).

If I run pnpm dev I don't see any error message, my script works fine but after build it prompts this error, I don't know why this is happening.

from vite-vue3-chrome-extension-v3.

mubaidr avatar mubaidr commented on July 19, 2024

You are using imports inside a js file, which I believe gets transpiled during dev process. But when using build it is not processed therefore this error. Consider using npm pakcage for the ajax-hook

from vite-vue3-chrome-extension-v3.

botshen avatar botshen commented on July 19, 2024

You are using imports inside a js file, which I believe gets transpiled during dev process. But when using build it is not processed therefore this error. Consider using npm pakcage for the ajax-hook

image I started out using npm, but I switched to importing js when I got this error 'ajax-hook' is imported by src/content-script/inject.ts, but could not be resolved – treating it as an external dependency

from vite-vue3-chrome-extension-v3.

mubaidr avatar mubaidr commented on July 19, 2024

Did you add package?

pnpm add ajax-hook

and then

pnpm i

from vite-vue3-chrome-extension-v3.

botshen avatar botshen commented on July 19, 2024

Did you add package?你添加了包吗?

pnpm add ajax-hook

and then 进而

pnpm i

I of course ran the command to add the dependency and this is my package.json

{
  "dependencies": {
    "ajax-hook": "^3.0.1",
    "vue": "^3.3.4",
    "vue-router": "^4.2.4"
  },
  "devDependencies": {
    "@crxjs/vite-plugin": "^2.0.0-beta.18",
    "@iconify-json/mdi": "^1.1.54",
    "@tailwindcss/forms": "^0.5.4",
    "@types/chrome": "^0.0.243",
    "@types/eslint": "^8.44.2",
    "@types/eslint-config-prettier": "^6.11.0",
    "@types/node": "^18.17.3",
    "@types/prettier": "^3.0.0",
    "@typescript-eslint/eslint-plugin": "^6.3.0",
    "@typescript-eslint/parser": "^6.3.0",
    "@vitejs/plugin-vue": "^4.2.3",
    "@vue/compiler-sfc": "^3.3.4",
    "@vueuse/core": "^10.3.0",
    "autoprefixer": "^10.4.14",
    "eslint": "^8.46.0",
    "eslint-config-prettier": "^9.0.0",
    "eslint-plugin-vue": "^9.16.1",
    "postcss": "^8.4.27",
    "prettier": "^3.0.1",
    "prettier-plugin-tailwindcss": "^0.4.1",
    "sass": "^1.64.2",
    "tailwindcss": "^3.3.3",
    "typescript": "^5.1.6",
    "unplugin-auto-import": "^0.16.6",
    "unplugin-icons": "^0.16.5",
    "unplugin-vue-components": "^0.25.1",
    "vite": "^4.4.9",
    "vite-plugin-pages": "^0.31.0",
    "vue-tsc": "^1.8.8",
    "webext-bridge": "^6.0.1"
  },
  "name": "vite-vue3-chrome-extension-v3",
  "overrides": {
    "@crxjs/vite-plugin": "$@crxjs/vite-plugin"
  },
  "pnpm": {
    "overrides": {},
    "peerDependencyRules": {
      "allowAny": [],
      "allowedDeprecatedVersions": {
        "sourcemap-codec": "1.4.8"
      },
      "allowedVersions": {},
      "ignoreMissing": []
    }
  },
  "private": true,
  "scripts": {
    "build": "vite build",
    "dev": "vite",
    "lint": "eslint . --fix --ext js,mjs,cjs,ts,mts,cts,vue",
    "preview": "vite preview"
  },
  "type": "module",
  "version": "0.0.1"
}

The above error still exists and I'm struggling with it 🥺

from vite-vue3-chrome-extension-v3.

botshen avatar botshen commented on July 19, 2024

Can you help me look at it, I've been struggling with it for days and still no solution, google can't find an answer, thank you!

from vite-vue3-chrome-extension-v3.

mubaidr avatar mubaidr commented on July 19, 2024

I will check it, pls update repo to use npm package of ajax-hook

from vite-vue3-chrome-extension-v3.

botshen avatar botshen commented on July 19, 2024

I will check it, pls update repo to use npm package of ajax-hook

I've updated the repository, please check it for me if you have time, thanks again!

from vite-vue3-chrome-extension-v3.

mubaidr avatar mubaidr commented on July 19, 2024
  • You can inject scripts using manifest.config.js
    OR
  • you can import scripts into content script, vite will process these too.

botshen/mock-v3#1

from vite-vue3-chrome-extension-v3.

botshen avatar botshen commented on July 19, 2024
image image After packaging the js or using the import statement, the browser will report an error

from vite-vue3-chrome-extension-v3.

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.