2021-05-04 14:15:07 -05:00
|
|
|
import fs from 'fs';
|
|
|
|
|
2020-12-22 04:25:07 -05:00
|
|
|
import FriendlyErrorsPlugin from 'friendly-errors-webpack-plugin';
|
|
|
|
import HTMLWebpackPlugin from 'html-webpack-plugin';
|
2021-05-04 14:15:07 -05:00
|
|
|
import yalm from 'js-yaml';
|
2020-12-22 04:25:07 -05:00
|
|
|
import StyleLintPlugin from 'stylelint-webpack-plugin';
|
|
|
|
import webpack from 'webpack';
|
|
|
|
|
|
|
|
import env from '../config/env';
|
|
|
|
|
|
|
|
import getPackageJson from './getPackageJson';
|
|
|
|
import baseConfig from './webpack.config';
|
|
|
|
|
2021-05-04 14:15:07 -05:00
|
|
|
const configJsonFormat = yalm.safeLoad(fs.readFileSync('./tools/_verdaccio.config.yaml', 'utf8'));
|
2020-12-22 04:25:07 -05:00
|
|
|
export default {
|
|
|
|
...baseConfig,
|
|
|
|
mode: 'development',
|
|
|
|
entry: {
|
|
|
|
main: [
|
|
|
|
'whatwg-fetch',
|
|
|
|
'react-hot-loader/patch',
|
2021-04-15 14:10:28 -05:00
|
|
|
'webpack-dev-server/client?http://localhost:4873',
|
2020-12-22 04:25:07 -05:00
|
|
|
'webpack/hot/only-dev-server',
|
|
|
|
`${env.SRC_ROOT}/index.tsx`,
|
|
|
|
],
|
|
|
|
},
|
|
|
|
|
|
|
|
output: {
|
|
|
|
...baseConfig.output,
|
|
|
|
publicPath: '/',
|
|
|
|
},
|
|
|
|
|
|
|
|
devtool: 'inline-cheap-module-source-map',
|
|
|
|
|
|
|
|
plugins: [
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
__DEBUG__: true,
|
|
|
|
__APP_VERSION__: `"${getPackageJson('version')}"`,
|
|
|
|
}),
|
|
|
|
new HTMLWebpackPlugin({
|
|
|
|
__UI_OPTIONS: JSON.stringify({
|
2021-05-04 14:15:07 -05:00
|
|
|
...configJsonFormat.web,
|
2021-03-06 12:56:45 -05:00
|
|
|
filename: 'index.html',
|
|
|
|
verdaccioURL: '//localhost:4873',
|
2021-04-15 14:10:28 -05:00
|
|
|
base: new URL('/', 'http://localhost:4873'),
|
2020-12-22 04:25:07 -05:00
|
|
|
}),
|
|
|
|
template: `${env.SRC_ROOT}/template/index.html`,
|
|
|
|
debug: true,
|
|
|
|
inject: true,
|
|
|
|
}),
|
|
|
|
new webpack.HotModuleReplacementPlugin(),
|
|
|
|
new webpack.NoEmitOnErrorsPlugin(),
|
|
|
|
new FriendlyErrorsPlugin(),
|
|
|
|
new StyleLintPlugin({
|
|
|
|
files: ['src/**/styles.ts'],
|
|
|
|
failOnError: false,
|
|
|
|
emitErrors: false,
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
};
|