Skip to content

Commit

Permalink
WIP: Extended extension.config.js (#188)
Browse files Browse the repository at this point in the history
  • Loading branch information
cezaraugusto authored Sep 17, 2024
1 parent cbf2c9b commit 1c68c29
Show file tree
Hide file tree
Showing 25 changed files with 205 additions and 237 deletions.
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

0 comments on commit 1c68c29

Please sign in to comment.