mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
feat: platform suffix resolution [wip]
This commit is contained in:
@ -18,6 +18,7 @@ import {
|
||||
getPlatform,
|
||||
} from '../helpers/project';
|
||||
import { hasDependency } from '../helpers/dependencies';
|
||||
import { PlatformSuffixPlugin } from '../plugins/PlatformSuffixPlugin';
|
||||
|
||||
export default function (config: Config, env: IWebpackEnv): Config {
|
||||
const entryPath = getEntryPath();
|
||||
@ -28,6 +29,10 @@ export default function (config: Config, env: IWebpackEnv): Config {
|
||||
// set mode
|
||||
config.mode(mode);
|
||||
|
||||
// config.stats({
|
||||
// logging: 'verbose'
|
||||
// })
|
||||
|
||||
// package.json is generated by the CLI with runtime options
|
||||
// this ensures it's not included in the bundle, but rather
|
||||
// resolved at runtime
|
||||
@ -194,6 +199,22 @@ export default function (config: Config, env: IWebpackEnv): Config {
|
||||
},
|
||||
]);
|
||||
|
||||
// config.plugin('NormalModuleReplacementPlugin').use(NormalModuleReplacementPlugin, [
|
||||
// /.*/,
|
||||
// request => {
|
||||
// if (new RegExp(`\.${platform}\..+$`).test(request.request)) {
|
||||
// request.rawRequest = request.rawRequest.replace(`.${platform}.`, '.')
|
||||
// console.log(request)
|
||||
// }
|
||||
// }
|
||||
// ])
|
||||
|
||||
config.plugin('PlatformSuffixPlugin').use(PlatformSuffixPlugin, [
|
||||
{
|
||||
platform,
|
||||
},
|
||||
]);
|
||||
|
||||
// todo: refine defaults
|
||||
config.plugin('DefinePlugin').use(DefinePlugin, [
|
||||
{
|
||||
|
Reference in New Issue
Block a user