Work in progress converting playground to invoke webpack using Heft
This commit is contained in:
Родитель
88f0d06cd6
Коммит
9aea179474
|
@ -68,4 +68,7 @@ common/autoinstallers/*/.npmrc
|
|||
temp/
|
||||
lib/
|
||||
dist/
|
||||
.heft/
|
||||
|
||||
# Heft
|
||||
*/.heft/build-cache/**
|
||||
*/.heft/temp/**
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"pathsToDelete": ["dist", "lib", "temp"]
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"webpackConfigFilePath": "./webpack.config.js"
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
const productionIndex = process.argv.indexOf('--production');
|
||||
if (productionIndex !== -1) {
|
||||
process.argv[productionIndex] = '--env.production';
|
||||
}
|
||||
|
||||
require('webpack-cli/bin/cli');
|
|
@ -5,10 +5,10 @@
|
|||
"private": true,
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"build": "node build.js --production",
|
||||
"lint": "eslint -f unix \"src/**/*.{ts,tsx}\"",
|
||||
"start": "node node_modules/webpack-dev-server/bin/webpack-dev-server --config webpack.dev.config.js --open"
|
||||
},
|
||||
"build": "heft build --clean",
|
||||
"start": "heft serve",
|
||||
"lint": "eslint -f unix \"src/**/*.{ts,tsx}\""
|
||||
},
|
||||
"dependencies": {
|
||||
"@microsoft/tsdoc": "0.12.20",
|
||||
"@types/react": "16.9.11",
|
||||
|
@ -18,7 +18,9 @@
|
|||
"tslib": "~1.10.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@microsoft/rush-stack-compiler-3.5": "~0.8.1",
|
||||
"@rushstack/eslint-config": "1.0.1",
|
||||
"@rushstack/heft": "^0.1.0",
|
||||
"@rushstack/set-webpack-public-path-plugin": "~2.4.1",
|
||||
"@types/webpack-env": "~1.14.0",
|
||||
"@types/webpack": "4.39.8",
|
||||
|
|
|
@ -1,21 +1,12 @@
|
|||
{
|
||||
"$schema": "http://json.schemastore.org/tsconfig",
|
||||
|
||||
"extends": "./node_modules/@microsoft/rush-stack-compiler-3.5/includes/tsconfig-node.json",
|
||||
"compilerOptions": {
|
||||
"module": "esnext",
|
||||
"target": "es5",
|
||||
"sourceMap": true,
|
||||
"allowJs": true,
|
||||
"jsx": "react",
|
||||
"moduleResolution": "node",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noImplicitReturns": true,
|
||||
"noImplicitThis": true,
|
||||
"noImplicitAny": true,
|
||||
"importHelpers": true,
|
||||
"strictNullChecks": true,
|
||||
"suppressImplicitAnyIndexErrors": true,
|
||||
"noUnusedLocals": true,
|
||||
"types": [
|
||||
"webpack-env"
|
||||
],
|
||||
|
@ -26,11 +17,6 @@
|
|||
"es2015.collection",
|
||||
"es2015.symbol",
|
||||
"es2015.iterable"
|
||||
],
|
||||
"outDir": "lib"
|
||||
},
|
||||
"include": [
|
||||
"./src/**/*.ts",
|
||||
"./src/**/*.tsx",
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,11 +2,9 @@
|
|||
|
||||
const webpack = require('webpack');
|
||||
const path = require('path');
|
||||
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
||||
const { SetPublicPathPlugin } = require('@rushstack/set-webpack-public-path-plugin');
|
||||
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
|
||||
|
||||
const REACT_URL = {
|
||||
dev: 'https://cdnjs.cloudflare.com/ajax/libs/react/16.4.2/umd/react.development.js',
|
||||
|
@ -42,12 +40,6 @@ module.exports.generateServeWebpackConfiguration = function () {
|
|||
}
|
||||
|
||||
function _generateBaseWebpackConfiguration(isProduction) {
|
||||
const options = {
|
||||
pwd: __dirname,
|
||||
entrypoint: path.join(__dirname, 'src', 'index.ts'),
|
||||
bundleName: 'tsdoc-playground',
|
||||
production: (process.env || {}).production
|
||||
};
|
||||
const distDirectory = path.join(__dirname, 'dist');
|
||||
const monacoUrl = isProduction ? MONACO_URL.production : MONACO_URL.dev;
|
||||
|
||||
|
@ -88,14 +80,14 @@ function _generateBaseWebpackConfiguration(isProduction) {
|
|||
]
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
|
||||
extensions: ['.js', '.jsx', '.json'],
|
||||
alias: {
|
||||
'tslib': 'tslib/tslib.es6'
|
||||
}
|
||||
},
|
||||
devtool: (isProduction) ? undefined : 'source-map',
|
||||
entry: {
|
||||
'tsdoc-playground': path.join(__dirname, 'src', 'index.tsx')
|
||||
'tsdoc-playground': path.join(__dirname, 'lib', 'index.js')
|
||||
},
|
||||
externals: {
|
||||
'react': 'React',
|
||||
|
@ -112,14 +104,6 @@ function _generateBaseWebpackConfiguration(isProduction) {
|
|||
minimize: isProduction
|
||||
},
|
||||
plugins: [
|
||||
new CleanWebpackPlugin({
|
||||
cleanOnceBeforeBuildPatterns: [
|
||||
path.join(__dirname, 'lib/'),
|
||||
path.join(__dirname, 'dist/'),
|
||||
path.join(__dirname, 'temp/')
|
||||
],
|
||||
verbose: false
|
||||
}),
|
||||
new HtmlWebpackPlugin({
|
||||
inject: true,
|
||||
template: `handlebars-loader!${path.join(__dirname, 'public', 'index.hbs')}`,
|
||||
|
@ -153,11 +137,6 @@ function _generateBaseWebpackConfiguration(isProduction) {
|
|||
DEBUG: !isProduction,
|
||||
'process.env.NODE_ENV': JSON.stringify(isProduction ? 'production' : 'dev'),
|
||||
MONACO_URL: JSON.stringify(monacoUrl)
|
||||
}),
|
||||
new ForkTsCheckerWebpackPlugin({
|
||||
async: false,
|
||||
eslint: true,
|
||||
watch: isProduction ? path.join(__dirname, 'src') : undefined
|
||||
})
|
||||
]
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче