Add weback-dev-server with hot/hmr support

* adds `npm start` / `yarn start` script
* starts a webpack-dev-server using the dev config, served on :3333
* hot reloading (HMR) for react/styles, not working for angular code
* new entry `dev.ts` for dynamic imports of CSS theme (ExtractText does
not work with HMR)
* TS loader pipeline moved out of common to add HMR for react
* applied `hot()` to some react containers (that's their new default
 export, named exports remains for testing)
* added sections to README
* updated yarn.lock
This commit is contained in:
David Kaltschmidt
2018-04-18 15:01:36 +02:00
parent e21d574814
commit cc5d7002b0
16 changed files with 1061 additions and 60 deletions

View File

@ -1,5 +1,5 @@
const path = require('path');
const {CheckerPlugin} = require('awesome-typescript-loader')
const { CheckerPlugin } = require('awesome-typescript-loader');
module.exports = {
target: 'web',
@ -11,8 +11,8 @@ module.exports = {
},
output: {
path: path.resolve(__dirname, '../../public/build'),
filename: '[name].[chunkhash].js',
publicPath: "public/build/",
filename: '[name].[hash].js',
publicPath: "/public/build/",
},
resolve: {
extensions: ['.ts', '.tsx', '.es6', '.js', '.json'],
@ -28,25 +28,6 @@ module.exports = {
},
module: {
rules: [
{
test: /\.tsx?$/,
enforce: 'pre',
exclude: /node_modules/,
use: {
loader: 'tslint-loader',
options: {
emitErrors: true,
typeCheck: false,
}
}
},
{
test: /\.tsx?$/,
exclude: /node_modules/,
use: [
{ loader: "awesome-typescript-loader" }
]
},
{
test: require.resolve('jquery'),
use: [
@ -64,7 +45,7 @@ module.exports = {
test: /\.html$/,
exclude: /index\.template.html/,
use: [
{ loader:'ngtemplate-loader?relativeTo=' + (path.resolve(__dirname, '../../public')) + '&prefix=public'},
{ loader: 'ngtemplate-loader?relativeTo=' + (path.resolve(__dirname, '../../public')) + '&prefix=public' },
{
loader: 'html-loader',
options: {