get webpack dev server working

This commit is contained in:
Jeff Colombo 2019-03-18 16:07:59 -04:00
parent 0788dd7109
commit 1840db6ec7
5 changed files with 13 additions and 10 deletions

2
dist/main-bundle.js vendored

File diff suppressed because one or more lines are too long

View File

@ -5,8 +5,7 @@
"lint": "tslint --project tslint.json",
"package": "yarn build --config webpack.config.prod.js --bail --display-used-exports -p",
"package-for-test": "yarn build --config webpack.config.test.js --bail --display-used-exports",
"start": "webpack-dev-server --config webpack.config.js --progress --colors --port 8000 --env.WARN_ON_LINT",
"watch": "yarn build --config webpack.config.js --colors --debug --output-pathinfo --progress --watch --env.WARN_ON_LINT",
"start": "./node_modules/webpack-dev-server/bin/webpack-dev-server.js --config webpack.config.js --progress --colors --debug --output-pathinfo --port 8000 --env.WARN_ON_LINT",
"build": "node ./node_modules/webpack/bin/webpack.js --cache=true --display-error-details --profile",
"clean": "rm -rf ./dist/*",
"tsnode": "node -r ts-node/register -r tsconfig-paths/register"

View File

@ -40,7 +40,7 @@ export class Header extends React.Component<IHeaderProps> {
to="/explorer/1/0"
// style={ style }
// className={ anchorCss }
// onClick={ onClick }
onClick={ this.reload }
>
PVPokemon
</Link>
@ -56,4 +56,6 @@ export class Header extends React.Component<IHeaderProps> {
</header>
);
}
private readonly reload = () => window.location.reload();
}

View File

@ -33,10 +33,12 @@ module.exports = function (env) {
return {
devServer: {
contentBase: __dirname,
publicPath: '/' + options.outputDirectory + '/',
contentBase: [path.resolve(__dirname), path.resolve(__dirname, options.outputDirectory)],
historyApiFallback: true,
// watchContentBase: true,
writeToDisk: true,
hot: false,
// hot: false,
},
entry: {
'global': [

View File

@ -2,7 +2,7 @@ const webpack = require('webpack');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const WebpackShellPlugin = require('webpack-shell-plugin');
const outputDirectory = './dist';
const outputDirectory = 'dist';
module.exports.outputDirectory = outputDirectory;
module.exports.getOptimizations = function () {
@ -14,7 +14,7 @@ module.exports.getOptimizations = function () {
filename: 'commons-bundle.js',
chunks: 'initial',
// (the filename of the commons chunk)
minChunks: 2,
minChunks: 3,
}
}
}
@ -57,8 +57,8 @@ module.exports.getPlugins = function (env) {
dev: false,
onBuildEnd:[
'echo "Starting CSS Merging"',
'node cssConcatenator.js ' + outputDirectory + ' global.tmp.css global.css ' + !!env.CSS_SOURCEMAPS,
'node cssConcatenator.js ' + outputDirectory + ' !(global).tmp.css app.css ' + !!env.CSS_SOURCEMAPS,
'node cssConcatenator.js ./' + outputDirectory + ' global.tmp.css global.css ' + !!env.CSS_SOURCEMAPS,
'node cssConcatenator.js ./' + outputDirectory + ' !(global).tmp.css app.css ' + !!env.CSS_SOURCEMAPS,
]
})
];