Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Extended extension.config.js #188

Merged
merged 4 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
EXTENSION_ENV=
EXPERIMENTAL_ERRORS_PLUGIN=
EXPERIMENTAL_EXTENSION_RESOLVER_PLUGIN=
2 changes: 1 addition & 1 deletion examples/config-babel/extension.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** @type {import('extension-develop').FileConfig} */
/** @type {import('extension').FileConfig} */
module.exports = {
config: (config) => {
config.module.rules.push(
Expand Down
8 changes: 6 additions & 2 deletions examples/content-extension-config/content/ContentApp.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import ReactLogo from '../images/logo.svg'
import reactLogo from '../images/react.png'
import tailwindBg from '../images/tailwind_bg.png'
import typescriptLogo from '../images/typescript.png'
import tailwindLogo from '../images/tailwind.png'
Expand Down Expand Up @@ -38,7 +38,11 @@ export default function ContentApp() {
</div>
<div className="mx-auto max-w-md text-center lg:py-12 lg:mx-0 lg:flex-auto lg:text-left">
<div className="flex items-center justify-center space-x-4 my-4 mx-auto">
<ReactLogo className="relative inline-block w-12" />
<img
alt="React logo"
src={reactLogo}
className="relative inline-block w-12"
/>
<div className="text-3xl text-white">+</div>
<img
alt="TypeScript logo"
Expand Down
54 changes: 34 additions & 20 deletions examples/content-extension-config/extension.config.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,36 @@
/** @type {import('extension-develop').FileConfig} */
/** @type {import('extension').FileConfig} */
module.exports = {
config: (config) => {
config.module.rules.push(
{
test: /\.svg$/i,
type: 'asset',
// *.svg?url
resourceQuery: /url/
},
{
test: /\.svg$/i,
issuer: /\.[jt]sx?$/,
// exclude react component if *.svg?url
resourceQuery: {not: [/url/]},
use: ['@svgr/webpack']
}
)

return config
}
browsers: {
chrome: {
// noOpen?: boolean
// userDataDir?: string
// profile?: string
// preferences?: Record<string, any>
// browserFlags?: string[]
// startingUrl?: string
// chromiumBinary?: string
startingUrl: 'https://extension.js.org'
},
firefox: {
// noOpen?: boolean
// userDataDir?: string
// profile?: string
// preferences?: Record<string, any>
// browserFlags?: string[]
// startingUrl?: string
// geckoBinary?: string
startingUrl: 'about:debugging#/runtime/this-firefox'
}
},
development: {
// TBD
// browser: DevOptions['browser']
// port?: number
// browser: 'firefox', // can be an array
// zipFilename?: string
// zip?: boolean
// zipSource?: boolean
// polyfill?: boolean
},
deployment: {}
}
9 changes: 0 additions & 9 deletions examples/content-extension-config/images/logo.svg

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion examples/content-extension-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"url": "https://cezaraugusto.com"
},
"dependencies": {
"@svgr/webpack": "^8.1.0",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"tailwindcss": "^3.4.1"
Expand Down
2 changes: 1 addition & 1 deletion examples/content-main-world/extension.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** @type {import('extension-develop').FileConfig} */
/** @type {import('extension').FileConfig} */
module.exports = {
config: (config) => {
config.output.publicPath =
Expand Down
2 changes: 1 addition & 1 deletion examples/content-react-svgr/extension.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** @type {import('extension-develop').FileConfig} */
/** @type {import('extension').FileConfig} */
module.exports = {
config: (config) => {
config.module.rules.push(
Expand Down
2 changes: 1 addition & 1 deletion examples/new-crypto/extension.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin')

/** @type {import('extension-develop').FileConfig} */
/** @type {import('extension').FileConfig} */
module.exports = {
config: (config) => {
config.plugins = [
Expand Down
Loading
Loading