Use ts-loader with webpack to avoid needing to compile lib-es3.

This commit is contained in:
David Anson 2021-01-06 19:45:15 -08:00
parent 868310a094
commit 5838b62e6d
7 changed files with 358 additions and 335 deletions

File diff suppressed because it is too large Load diff

9
demo/tsconfig.json Normal file
View file

@ -0,0 +1,9 @@
{
"compilerOptions": {
"allowJs": true,
"resolveJsonModule": true
},
"include": [
"../lib/*.js"
]
}

View file

@ -2,6 +2,7 @@
"use strict";
const path = require("path");
const webpack = require("webpack");
function config(options) {
@ -14,6 +15,21 @@ function config(options) {
"markdown-it": "markdownit"
},
"mode": mode,
"module": {
"rules": [
{
"test": /.js$/,
"use": [
{
"loader": "ts-loader",
"options": {
"configFile": path.resolve(__dirname, "tsconfig.json")
}
}
]
}
]
},
"name": name,
"output": {
"filename": filename,
@ -41,25 +57,25 @@ function config(options) {
module.exports = [
config({
"entry": "../lib-es3/lib/markdownlint.js",
"entry": "../lib/markdownlint.js",
"filename": "markdownlint-browser.js",
"mode": "development",
"packageJson": require("../package.json")
}),
config({
"entry": "../lib-es3/lib/markdownlint.js",
"entry": "../lib/markdownlint.js",
"filename": "markdownlint-browser.min.js",
"mode": "production",
"packageJson": require("../package.json")
}),
config({
"entry": "../lib-es3/helpers/helpers.js",
"entry": "../helpers/helpers.js",
"filename": "markdownlint-rule-helpers-browser.js",
"mode": "development",
"packageJson": require("../helpers/package.json")
}),
config({
"entry": "../lib-es3/helpers/helpers.js",
"entry": "../helpers/helpers.js",
"filename": "markdownlint-rule-helpers-browser.min.js",
"mode": "production",
"packageJson": require("../helpers/package.json")