Вот мой webpack.config.js
, я не вижу в нем ничего странного (например, бесконечный пул потоков), который мог бы вызвать зависание, но мне всегда нужно вручную Ctrl + C шаг, чтобы продолжить. Это было незначительное неудобство, но я хочу решить его при рефакторинге кода развертывания.
const path = require('path');
const version = require('./VERSION').version;
const SentryWebpackPlugin = require('@sentry/webpack-plugin');
module.exports = {
mode: process.env.NODE_ENV,
entry: './client/index.js',
output: {
filename: 'client.js',
libraryTarget: 'var',
library: 'ui',
path: path.resolve(__dirname, 'dist'),
publicPath: '/dist/',
},
module: {
rules: [
{
test: /\.m?js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env', '@babel/preset-flow'],
},
},
},
],
},
plugins: [
new SentryWebpackPlugin({
include: '.',
ignoreFile: '.sentrycliignore',
ignore: [
'node_modules',
'lib',
'server',
'flow-typed',
'scripts',
'webpack.config.js'
],
configFile: 'sentry.properties',
release: version
})
],
watch: true,
watchOptions: {
ignored: ['test', 'node_modules', 'scripts'],
},
devtool: 'inline-source-map',
devServer: {
contentBase: path.join(__dirname, 'dist'),
publicPath: '/dist/',
},
};
Вот как выглядит мой package.json
:
{
"name": "investomation-api",
"version": "0.0.1",
"description": "...",
"private": true,
"main": "server.js",
"scripts": {
"build": "NODE_ENV=production npm install && webpack --mode production",
"start": "PORT=443 NODE_ENV=production pm2 start server/start.js",
"restart": "pm2 restart 0",
"start:dev": "PORT=3002 NODE_ENV=development nodemon server/dev-start.js",
"flow": "flow",
"server:upload": "cd scripts && ./upload"
},
"repository": {
"type": "git",
"url": "..."
},
"nodemonConfig": {
"ignore": [
"cypress/",
"node_modules/",
"scripts/",
"tests/"
]
},
"prettier": {
"tabWidth": 4
},
"author": "Alexander Tsepkov",
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
"@mapbox/geojson-types": "^1.0.2",
"bcrypt": "^3.0.7",
"body-parser": "^1.19.0",
"connect-flash": "^0.1.1",
"connect-sqlite3": "^0.9.11",
"cookie-parser": "^1.4.4",
"cors": "^2.8.5",
"csv-parser": "^2.3.2",
"d3": "^5.15.0",
"dialog-polyfill": "^0.5.0",
"dotenv": "^8.2.0",
"ejs": "^2.7.4",
"express-session": "^1.17.0",
"https": "^1.0.0",
"knex": "^0.21.1",
"morgan": "^1.9.1",
"multer": "^1.4.2",
"node-fetch": "^2.6.0",
"nodemailer": "^6.4.2",
"objection": "^2.1.3",
"passport": "^0.4.1",
"passport-local": "^1.0.0",
"sharp": "^0.25.4",
"sqlite3": "^4.1.1",
"stripe": "^7.15.0"
},
"devDependencies": {
"@babel/core": "^7.8.3",
"@babel/node": "^7.8.3",
"@babel/preset-env": "^7.8.3",
"@babel/preset-flow": "^7.8.3",
"@babel/register": "^7.8.3",
"@sentry/webpack-plugin": "^1.9.3",
"babel-loader": "^8.0.6",
"css.escape": "^1.5.1",
"cypress": "^4.5.0",
"flow-bin": "^0.107.0",
"html-webpack-plugin": "^3.2.0",
"jsdom": "^15.2.1",
"mocha": "^6.2.2",
"nodemon": "^1.19.4",
"test-drone": "0.0.13",
"webpack": "^4.41.5",
"webpack-cli": "^3.3.10",
"webpack-dev-server": "^3.10.1"
}
}
Я порождаю процесс через npm run build
, client.js
построен правильно, но процесс сборки webpack никогда не завершается.