-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for multiple tsconfig paths (#79)
* Add support for multiple tsconfig paths * Update readme and add test --------- Co-authored-by: Will Lynch <will.lynch@oracle.com>
- Loading branch information
Showing
37 changed files
with
246 additions
and
21 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
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 { TsconfigPathsPlugin } from "../../../../src/index"; | ||
import TsconfigPathsPluginDefault from "../../../../src/index"; | ||
|
||
const plugin1 = new TsconfigPathsPlugin(); | ||
const plugin2 = new TsconfigPathsPluginDefault(); |
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
File renamed without changes.
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,25 @@ | ||
const fs = require("fs"); | ||
const webpack = require("webpack"); | ||
|
||
const config = require("./webpack.config"); | ||
|
||
const compiler = webpack(config); | ||
|
||
compiler.inputFileSystem = fs; | ||
|
||
compiler.run(function (error, stats) { | ||
if (error) { | ||
console.error(error); | ||
return process.exit(1); | ||
} | ||
|
||
if (stats.compilation.errors.length) { | ||
stats.compilation.errors.forEach((compilationError) => { | ||
console.error(compilationError); | ||
}); | ||
|
||
return process.exit(1); | ||
} | ||
|
||
console.log("Successfully compiled"); | ||
}); |
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,16 @@ | ||
import * as foo from "src/mapped/buzz"; | ||
import * as bar from "src/mapped/fizz/file1"; | ||
import * as myStar from "star-bar"; | ||
import * as packagedBrowser from "browser-field-package"; | ||
import * as packagedMain from "main-field-package"; | ||
import * as packagedIndex from "no-main-field-package"; | ||
|
||
console.log( | ||
"HELLO WORLD!", | ||
foo.message, | ||
bar.message, | ||
myStar.message, | ||
packagedBrowser.message, | ||
packagedMain.message, | ||
packagedIndex.message | ||
); |
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 @@ | ||
export const message = "fizz"; |
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 @@ | ||
export const message = "GOODBYE!"; |
1 change: 1 addition & 0 deletions
1
examples/referenceExample/src/mapped/star/browser-field-package/browser.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 @@ | ||
export const message = "browser"; |
1 change: 1 addition & 0 deletions
1
examples/referenceExample/src/mapped/star/browser-field-package/node.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 @@ | ||
export const message = "node"; |
5 changes: 5 additions & 0 deletions
5
examples/referenceExample/src/mapped/star/browser-field-package/package.json
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 @@ | ||
{ | ||
"name": "browser-field", | ||
"main": "node.ts", | ||
"browser": "browser.ts" | ||
} |
1 change: 1 addition & 0 deletions
1
examples/referenceExample/src/mapped/star/main-field-package/node.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 @@ | ||
export const message = "node"; |
4 changes: 4 additions & 0 deletions
4
examples/referenceExample/src/mapped/star/main-field-package/package.json
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,4 @@ | ||
{ | ||
"name": "main-field", | ||
"main": "node.ts" | ||
} |
1 change: 1 addition & 0 deletions
1
examples/referenceExample/src/mapped/star/no-main-field-package/index.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 @@ | ||
export const message = "index"; |
3 changes: 3 additions & 0 deletions
3
examples/referenceExample/src/mapped/star/no-main-field-package/package.json
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,3 @@ | ||
{ | ||
"name": "no-main-field" | ||
} |
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 @@ | ||
export const message = "Hello Star!"; |
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 { TsconfigPathsPlugin } from "../../../../src/index"; | ||
import TsconfigPathsPluginDefault from "../../../../src/index"; | ||
|
||
const plugin1 = new TsconfigPathsPlugin(); | ||
const plugin2 = new TsconfigPathsPluginDefault(); |
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,19 @@ | ||
{ | ||
"compilerOptions": { | ||
// Output | ||
"module": "commonjs", | ||
"target": "es5", | ||
"outDir": "./js_out", | ||
"baseUrl": ".", | ||
"paths": { | ||
"foo": ["src/mapped/bar"], | ||
"bar/*": ["src/mapped/foo/*"], | ||
"*": ["./src/mapped/star/*"] | ||
} | ||
}, | ||
"references": [ | ||
{ | ||
"path": "../example/tsconfig.json" | ||
} | ||
] | ||
} |
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,37 @@ | ||
const path = require("path"); | ||
const TsconfigPathsPlugin = require("../"); | ||
|
||
module.exports = { | ||
mode: "development", | ||
context: path.resolve(__dirname, "src"), | ||
entry: "./index", | ||
output: { | ||
path: path.join(__dirname, "temp"), | ||
filename: "bundle.js", | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\\.tsx?$/, | ||
exclude: /^node_modules/, | ||
loader: "ts-loader", | ||
options: { | ||
configFile: "./example/tsconfig.json", | ||
}, | ||
}, | ||
], | ||
}, | ||
resolve: { | ||
extensions: [".ts", ".tsx", ".js"], | ||
plugins: [ | ||
new TsconfigPathsPlugin({ | ||
configFile: "./tsconfig.json", | ||
logLevel: "info", | ||
extensions: [".ts", ".tsx"], | ||
mainFields: ["browser", "main"], | ||
references: ["../example/tsconfig.json"] | ||
// baseUrl: "/foo" | ||
}), | ||
], | ||
}, | ||
}; |
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.