-
-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure no conflicts across other loaders
- Loading branch information
1 parent
3cf223f
commit 937a83a
Showing
19 changed files
with
175 additions
and
346 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,20 @@ | ||
/** @type {import('extension-develop').Config} */ | ||
/** @type {import('extension-develop').ConfigFile} */ | ||
module.exports = { | ||
dev: { | ||
config: (config) => { | ||
config: (config) => { | ||
config.module.rules.push( | ||
{ | ||
test: /\.svg$/i, | ||
type: 'asset', | ||
resourceQuery: /url/ // *.svg?url | ||
}, | ||
{ | ||
test: /\.svg$/i, | ||
issuer: /\.[jt]sx?$/, | ||
resourceQuery: {not: [/url/]}, // exclude react component if *.svg?url | ||
use: [require.resolve('@svgr/webpack')] | ||
} | ||
) | ||
|
||
config.module.rules.push({ | ||
test: /\.svg$/i, | ||
issuer: /\.[jt]sx?$/, | ||
// exclude react component if *.svg?url | ||
resourceQuery: {not: [/url/]}, | ||
use: [require.resolve('@svgr/webpack')] | ||
}) | ||
|
||
return config | ||
} | ||
}, | ||
preview: { | ||
config: (config) => { | ||
return config | ||
} | ||
}, | ||
build: { | ||
config: (config) => { | ||
return config | ||
} | ||
return config | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,4 +34,4 @@ | |
"@types/react-dom": "^18.0.5", | ||
"typescript": "5.3.3" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import {Configuration} from 'webpack' | ||
|
||
export interface FileConfig { | ||
config: (config: Configuration) => Configuration | ||
} |
32 changes: 32 additions & 0 deletions
32
programs/develop/commands/commands-lib/get-extension-config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import fs from 'fs' | ||
import path from 'path' | ||
import {Configuration} from 'webpack' | ||
import {FileConfig} from './config-types' | ||
import * as messages from './messages' | ||
|
||
export function loadExtensionConfig(projectPath: string) { | ||
const userConfigPath = path.join(projectPath, 'extension.config.js') | ||
|
||
if (fs.existsSync(userConfigPath)) { | ||
if (isUsingExtensionConfig(projectPath)) { | ||
const userConfig: FileConfig = require(userConfigPath) | ||
if (userConfig && userConfig != null) { | ||
if (userConfig && typeof userConfig!.config === 'function') { | ||
return userConfig!.config | ||
} | ||
} | ||
} | ||
} | ||
|
||
return (config: Configuration) => config | ||
} | ||
|
||
export function isUsingExtensionConfig(projectPath: string) { | ||
const configPath = path.join(projectPath, 'extension.config.js') | ||
if (fs.existsSync(configPath)) { | ||
console.log(messages.isUsingExtensionConfig('extension.config.js')) | ||
return true | ||
} else { | ||
return false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.