revises webpack and npm structures to be compatible with package
This commit is contained in:
21
.babelrc
21
.babelrc
@@ -1,21 +0,0 @@
|
||||
{
|
||||
"presets": [
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
"modules": "commonjs"
|
||||
}
|
||||
],
|
||||
"@babel/preset-react"
|
||||
],
|
||||
"plugins": [
|
||||
"@babel/plugin-proposal-class-properties",
|
||||
"add-module-exports",
|
||||
[
|
||||
"@babel/plugin-transform-runtime",
|
||||
{
|
||||
"regenerator": true
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
3
index.js
Normal file
3
index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
const payload = require('./src');
|
||||
|
||||
module.exports = payload;
|
||||
19
package.json
19
package.json
@@ -13,17 +13,24 @@
|
||||
"test": "jest --config src/tests/jest.config.js",
|
||||
"test:int": "jest --config src/tests/jest.config.integration.js",
|
||||
"cov": "npm run core:build && node ./node_modules/jest/bin/jest.js src/tests --coverage",
|
||||
"webpack": "webpack-dev-server --mode development --config src/client/config/webpack.dev.config.js --open --hot --history-api-fallback",
|
||||
"debug": "nodemon --inspect ./demo/init.js",
|
||||
"dev": "nodemon demo/init.js",
|
||||
"build": "webpack --env.platform=web --config ./src/client/config/webpack.prod.config.js --mode production",
|
||||
"lint": "eslint **/*.js"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.8.3",
|
||||
"@babel/plugin-proposal-class-properties": "^7.8.3",
|
||||
"@babel/plugin-transform-runtime": "^7.8.3",
|
||||
"@babel/preset-env": "^7.8.3",
|
||||
"@babel/preset-react": "^7.8.3",
|
||||
"@babel/runtime": "^7.8.3",
|
||||
"@hapi/joi": "^15.1.1",
|
||||
"accept-language-parser": "^1.5.0",
|
||||
"async-some": "^1.0.2",
|
||||
"babel-loader": "^8.0.6",
|
||||
"babel-jest": "^24.9.0",
|
||||
"babel-plugin-add-module-exports": "^1.0.2",
|
||||
"body-parser": "^1.19.0",
|
||||
@@ -75,17 +82,10 @@
|
||||
"webpack-hot-middleware": "^2.25.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.8.3",
|
||||
"@babel/plugin-proposal-class-properties": "^7.8.3",
|
||||
"@babel/plugin-transform-runtime": "^7.8.3",
|
||||
"@babel/preset-env": "^7.8.3",
|
||||
"@babel/preset-react": "^7.8.3",
|
||||
"@babel/runtime": "^7.8.3",
|
||||
"autoprefixer": "^9.7.4",
|
||||
"axios": "^0.18.1",
|
||||
"babel-core": "^7.0.0-bridge.0",
|
||||
"babel-eslint": "^10.0.1",
|
||||
"babel-loader": "^8.0.6",
|
||||
"circular-dependency-plugin": "^5.2.0",
|
||||
"css-loader": "^1.0.0",
|
||||
"eslint": "^6.8.0",
|
||||
@@ -107,6 +107,7 @@
|
||||
"sass-loader": "7.1.0",
|
||||
"style-loader": "^0.21.0",
|
||||
"supertest": "^3.4.2",
|
||||
"uglifyjs-webpack-plugin": "^1.2.7"
|
||||
"uglifyjs-webpack-plugin": "^1.2.7",
|
||||
"webpack-cli": "^3.3.11"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ const getStyleLoaders = (cssOptions, preProcessor) => {
|
||||
module.exports = (config) => {
|
||||
return {
|
||||
entry: {
|
||||
main: ['webpack-hot-middleware/client?path=/__webpack_hmr&timeout=20000', './src/client/components/index.js'],
|
||||
main: [path.resolve(__dirname, '../../../node_modules/webpack-hot-middleware/client?path=/__webpack_hmr&timeout=20000'), path.resolve(__dirname, '../components/index.js')],
|
||||
},
|
||||
output: {
|
||||
path: '/',
|
||||
@@ -52,6 +52,7 @@ module.exports = (config) => {
|
||||
},
|
||||
devtool: 'source-map',
|
||||
mode: 'development',
|
||||
resolveLoader: { modules: [path.join(__dirname, '../../../node_modules')] },
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
@@ -59,6 +60,27 @@ module.exports = (config) => {
|
||||
exclude: /node_modules/,
|
||||
use: {
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
presets: [
|
||||
[
|
||||
require.resolve('@babel/preset-env'),
|
||||
{
|
||||
modules: 'commonjs',
|
||||
},
|
||||
],
|
||||
require.resolve('@babel/preset-react'),
|
||||
],
|
||||
plugins: [
|
||||
require.resolve('@babel/plugin-proposal-class-properties'),
|
||||
require.resolve('babel-plugin-add-module-exports'),
|
||||
[
|
||||
require.resolve('@babel/plugin-transform-runtime'),
|
||||
{
|
||||
regenerator: true,
|
||||
},
|
||||
],
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -106,12 +128,13 @@ module.exports = (config) => {
|
||||
},
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin({
|
||||
template: './src/client/index.html',
|
||||
template: path.resolve(__dirname, '../index.html'),
|
||||
filename: './index.html',
|
||||
}),
|
||||
new webpack.HotModuleReplacementPlugin(),
|
||||
],
|
||||
resolve: {
|
||||
modules: [path.resolve(__dirname, '../../../node_modules')],
|
||||
alias: {
|
||||
payload: path.resolve(__dirname, '../../'),
|
||||
'payload-scss-overrides': config.paths.scssOverrides,
|
||||
|
||||
4
src/client/config/webpack.prod.config.js
Normal file
4
src/client/config/webpack.prod.config.js
Normal file
@@ -0,0 +1,4 @@
|
||||
module.exports = (env, argv) => {
|
||||
console.log(env);
|
||||
return {};
|
||||
};
|
||||
Reference in New Issue
Block a user