Skip to content

Commit 3884826

Browse files
author
nkakuev_cg
committed
new setup
1 parent f1c7759 commit 3884826

File tree

3 files changed

+1297
-114
lines changed

3 files changed

+1297
-114
lines changed

package.json

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
"author": "kakuevn <n.kakuev@gmail.com>",
66
"license": "MIT",
77
"scripts": {
8-
"dev": "rollup -c --watch",
9-
"build": "rollup -c",
10-
"lint:fix": "eslint './src/**/*.{ts,tsx}'",
8+
"dev": "webpack --colors --progress --watch",
9+
"build": "webpack --colors --progress -p",
10+
"eslint": "eslint './src/**/*.{ts,tsx}'",
11+
"eslint:fix": "eslint src --fix",
1112
"start": "npm-run-all --parallel dev test:watch",
1213
"test": "jest",
1314
"test:watch": "jest --watch"
@@ -16,14 +17,16 @@
1617
"testURL": "http://localhost/",
1718
"moduleDirectories": [
1819
"node_modules",
19-
"bower_components",
2020
"shared"
2121
],
2222
"transformIgnorePatterns": [
2323
"/node_modules/(?!(our-react-components-.*?\\.js$))"
2424
],
2525
"moduleNameMapper": {
2626
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js"
27+
},
28+
"transform": {
29+
"^.+\\.(js|jsx)$": "babel-jest"
2730
}
2831
},
2932
"dependencies": {
@@ -37,11 +40,18 @@
3740
"@typescript-eslint/eslint-plugin": "^1.7.0",
3841
"@typescript-eslint/parser": "^1.7.0",
3942
"awesome-typescript-loader": "^5.2.1",
43+
"babel-jest": "^24.7.1",
4044
"eslint": "^5.16.0",
4145
"eslint-config-prettier": "^4.2.0",
46+
"eslint-formatter-friendly": "^6.0.0",
47+
"eslint-loader": "^2.1.2",
4248
"eslint-plugin-react-hooks": "^1.6.0",
49+
"file-loader": "^3.0.1",
50+
"npm-run-all": "^4.1.5",
4351
"prettier": "^1.17.0",
4452
"source-map-loader": "^0.2.4",
45-
"typescript": "^3.4.5"
53+
"typescript": "^3.4.5",
54+
"uglifyjs-webpack-plugin": "^2.1.2",
55+
"webpack-cli": "^3.3.1"
4656
}
4757
}

webpack.config.js

Lines changed: 25 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
const path = require('path');
2+
const webpack = require('webpack');
3+
const lintFormatter = require('eslint-formatter-friendly');
4+
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
5+
16
module.exports = {
27
entry: './src/index.tsx',
38
output: {
@@ -10,6 +15,12 @@ module.exports = {
1015

1116
devtool: 'source-map',
1217

18+
stats: 'errors-only',
19+
20+
node: {
21+
fs: 'empty'
22+
},
23+
1324
resolve: {
1425
modules: [ path.resolve(__dirname, './src'), 'node_modules' ],
1526
extensions: [ '.ts', '.tsx', '.js', '.json' ]
@@ -29,10 +40,24 @@ module.exports = {
2940
failOnError: false
3041
}
3142
},
43+
{
44+
test: /\.(eot|svg|ttf|woff|woff2)$/,
45+
loader: 'file-loader?name=app/fonts/[name].[ext]'
46+
},
47+
{
48+
test: /\.(png|jpg|gif)$/,
49+
use: [
50+
{
51+
loader: 'file-loader',
52+
options: {}
53+
}
54+
]
55+
},
3256
{ test: /\.tsx?$/, loader: 'awesome-typescript-loader' },
3357
{ enforce: 'pre', test: /\.js$/, loader: 'source-map-loader' }
3458
]
3559
},
60+
plugins: [ new webpack.HotModuleReplacementPlugin(), new webpack.NamedModulesPlugin(), new UglifyJsPlugin() ],
3661

3762
externals: {
3863
react: {
@@ -53,86 +78,3 @@ module.exports = {
5378
}
5479
}
5580
};
56-
57-
// const path = require('path');
58-
// const webpack = require('webpack');
59-
// const lintFormatter = require('eslint-formatter-friendly');
60-
// const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
61-
62-
// module.exports = {
63-
// entry: './src/index.js',
64-
// output: {
65-
// filename: 'index.js',
66-
// path: path.resolve(__dirname, 'dist'),
67-
// publicPath: '/dist',
68-
// library: '',
69-
// libraryTarget: 'commonjs2'
70-
// },
71-
// resolve: {
72-
// modules: [ path.resolve(__dirname, './src'), 'node_modules' ],
73-
// extensions: [ '.js', '.jsx', '.json' ]
74-
// },
75-
76-
// externals: {
77-
// react: {
78-
// commonjs: 'react',
79-
// commonjs2: 'react',
80-
// amd: 'React',
81-
// root: 'React'
82-
// },
83-
// 'react-dom': {
84-
// commonjs: 'react-dom',
85-
// commonjs2: 'react-dom',
86-
// amd: 'ReactDOM',
87-
// root: 'ReactDOM'
88-
// },
89-
// 'styled-components': {
90-
// commonjs: 'styled-components',
91-
// commonjs2: 'styled-components'
92-
// }
93-
// },
94-
95-
// stats: 'errors-only',
96-
97-
// node: {
98-
// fs: 'empty'
99-
// },
100-
101-
// module: {
102-
// rules: [
103-
// {
104-
// enforce: 'pre',
105-
// test: /\.js?$/,
106-
// loader: 'eslint-loader',
107-
// exclude: /node_modules/,
108-
// options: {
109-
// configFile: './.eslintrc.json',
110-
// formatter: lintFormatter,
111-
// failOnWarning: false,
112-
// failOnError: false
113-
// }
114-
// },
115-
// {
116-
// test: /\.(eot|svg|ttf|woff|woff2)$/,
117-
// loader: 'file-loader?name=app/fonts/[name].[ext]'
118-
// },
119-
// {
120-
// test: /\.js?$/,
121-
// loader: 'babel-loader',
122-
// exclude: /node_modules/
123-
// },
124-
// {
125-
// test: /\.(png|jpg|gif)$/,
126-
// use: [
127-
// {
128-
// loader: 'file-loader',
129-
// options: {}
130-
// }
131-
// ]
132-
// }
133-
// ]
134-
// },
135-
// devtool: 'inline-source-map',
136-
137-
// plugins: [ new webpack.HotModuleReplacementPlugin(), new webpack.NamedModulesPlugin(), new UglifyJsPlugin() ]
138-
// };

0 commit comments

Comments
 (0)