Movatterモバイル変換


[0]ホーム

URL:


Framework
Customization
Use src Directory

Using thesrc directory for source code

Instead of having your source codes in the root directory, you can put them in a childsrc directory.

--with-src

Creating a Plasmo project with ansrc directory setup is as simple as:

pnpmcreateplasmo--with-src

The command above utilizes Plasmo'sexample template feature.

💡

Please ensure that theassets directory is in theproject directory NOT thesrc directory.

Please ensure thatALL source files including Plasmo's entry files such aspopup.tsx,options.tsx,background.ts,contents/* etc. are in thesrc directory. Otherwise, PlasmoWILL NOT know where to find the entry files, resulting in an empty extension!

This customization only resolves~ to/src for source codemodules. Please see this note abouttilde importresolution.

Manual Setup

First, copy all your source code files into thesrc directory. Then, for TypeScript to work correctly, you will need to point the resolvedpaths for the~* prefix in thetsconfig.json file to"./src/*".

The new configuration looks like this:

{"extends":"plasmo/templates/tsconfig.base","exclude": ["node_modules"],"include": [".plasmo/index.d.ts","./**/*.ts","./**/*.tsx"],"compilerOptions": {"paths": {"~*": ["./src/*"]    },"baseUrl":"."  }}

Seewith-src (opens in a new tab) for a full example.

Manifest OverrideReplace the HTML

[8]ページ先頭

©2009-2025 Movatter.jp