Conversation
| const config = webpackConfig(input); | ||
| expect(config.entry["tns_modules/tns-core-modules/inspector_modules"]).toEqual("inspector_modules"); | ||
| }); | ||
| // if (platform === "ios") { |
|
|
||
| const { mkdir } = require("shelljs"); | ||
| const { get } = require("request"); | ||
| // const { get } = require("request"); |
| "source-map-support": "^0.5.13", | ||
| "tns-core-modules": "next", | ||
| "typescript": "~3.5.3" | ||
| "@nativescript/core": "^6.5.8", |
There was a problem hiding this comment.
nit: the deps / dev deps should be alphabetised as is usually done automagically by npm, you can get npm to do it for you if you just install a dep at the version already in here
| "name": "nativescript-dev-webpack", | ||
| "version": "1.5.0", | ||
| "name": "@nativescript/webpack", | ||
| "version": "2.0.0-alpha.3", |
There was a problem hiding this comment.
There's a really strange divergence between the published version and the released version in this repo, a changelog or proper release notes on the tagged releases would help clear this up a lot
| "mochawesome": "~3.1.2", | ||
| "nativescript-dev-appium": "next", | ||
| "nativescript-dev-webpack": "next", | ||
| "@nativescript/webpack": "next", |
| "mochawesome": "~3.1.2", | ||
| "nativescript-dev-appium": "next", | ||
| "nativescript-dev-webpack": "next", | ||
| "@nativescript/webpack": "next", |
| "mochawesome": "~3.1.2", | ||
| "nativescript-dev-appium": "next", | ||
| "nativescript-dev-webpack": "next", | ||
| "@nativescript/webpack": "next", |
| registerModules = `(?<!${escapeRegExp(ignoredFiles[key])})` + registerModules; | ||
| } | ||
| registerModules = new RegExp(registerModules); | ||
| registerModules = <any>new RegExp(registerModules); |
There was a problem hiding this comment.
Opt for as T for type casting.
This any casting seems dangerous and seemingly dances around the typings issues that exist here, while functionally identical to before, is it safe? Looks more like the upstream typings are not ideal for this
Personally i'd opt for something more typesafe given the typings for ignoredFiles:
let registerModulesSafe: RegExp;
if (!registerModules) {
registerModules = defaultMatch;
// I assume you don't want to use a boolean
if (Array.isArray(ignoredFiles)) {
for (const ignoredFile of ignoredFiles) {
registerModules += `(?<!${escapeRegExp(ignoredFile)})`;
}
} else if (typeof ignoredFiles === "string") {
registerModules += `(?<!${escapeRegExp(ignoredFiles)})`;
}
registerModulesSafe = new RegExp(registerModules) as any;
}Then you can more safely load this expression further down:
} else if (registerModules || registerModulesSafe) {
...
const context = require.context("~/", true, ${registerModules || registerModulesSafe});
...
}| } | ||
| }); | ||
| const str = JSON.stringify(ast, (k, v) => k === "position" ? undefined : v); | ||
| this.callback(null, `${dependencies.join("\n")}module.exports = ${str};`, map); |
There was a problem hiding this comment.
Is removing map here safe? Is this for sourcemap generation?
No description provided.