Skip to content

Commit 5041566

Browse files
awiboxAndrei Arkhipov
authored and
Andrei Arkhipov
committed
#13: Code style for webpack.config.js
1 parent cc40361 commit 5041566

File tree

3 files changed

+61
-61
lines changed

3 files changed

+61
-61
lines changed

dist/index.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/main.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
.YourComponentName__text--2x8Bc{color:black;font-size:14px}
1+
.YourComponentName__text--2x8Bc{color:#000;font-size:14px}
22

webpack.config.js

+59-59
Original file line numberDiff line numberDiff line change
@@ -2,65 +2,65 @@ const path = require('path');
22
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
33

44
module.exports = {
5-
context: path.resolve(__dirname, 'src'),
6-
entry: './index.js',
7-
output: {
8-
path: __dirname + '/dist',
9-
filename: './index.js',
10-
publicPath: '/',
11-
libraryTarget: 'commonjs2'
12-
},
13-
resolve: {
14-
extensions: ['.js', '.jsx'],
15-
modules: ['node_modules']
16-
},
17-
optimization: {
18-
minimize: true
19-
},
20-
module: {
21-
rules: [
22-
{
23-
test: /\.jsx?$/,
24-
loader: 'babel-loader',
25-
},
26-
{
27-
test: /\.(sass|scss)$/,
28-
use: [
29-
{
30-
loader: MiniCssExtractPlugin.loader,
31-
},
32-
{
33-
loader: require.resolve('css-loader'),
34-
options: {
35-
importLoaders: 2,
36-
modules: {
37-
mode: 'local',
38-
localIdentName: '[name]__[local]--[hash:base64:5]',
39-
},
40-
},
41-
},
42-
'sass-loader',
43-
],
5+
context: path.resolve(__dirname, 'src'),
6+
entry: './index.js',
7+
output: {
8+
path: __dirname + '/dist',
9+
filename: './index.js',
10+
publicPath: '/',
11+
libraryTarget: 'commonjs2',
12+
},
13+
resolve: {
14+
extensions: ['.js', '.jsx'],
15+
modules: ['node_modules'],
16+
},
17+
optimization: {
18+
minimize: true,
19+
},
20+
module: {
21+
rules: [
22+
{
23+
test: /\.jsx?$/,
24+
loader: 'babel-loader',
25+
},
26+
{
27+
test: /\.(sass|scss)$/,
28+
use: [
29+
{
30+
loader: MiniCssExtractPlugin.loader,
31+
},
32+
{
33+
loader: require.resolve('css-loader'),
34+
options: {
35+
importLoaders: 2,
36+
modules: {
37+
mode: 'local',
38+
localIdentName: '[name]__[local]--[hash:base64:5]',
39+
},
4440
},
45-
]
46-
},
47-
plugins: [
48-
new MiniCssExtractPlugin({
49-
filename: './[name].css',
50-
}),
41+
},
42+
'sass-loader',
43+
],
44+
},
5145
],
52-
externals: {
53-
react: {
54-
commonjs: "react",
55-
commonjs2: "react",
56-
amd: "React",
57-
root: "React"
58-
},
59-
"react-dom": {
60-
commonjs: "react-dom",
61-
commonjs2: "react-dom",
62-
amd: "ReactDOM",
63-
root: "ReactDOM"
64-
}
65-
}
46+
},
47+
plugins: [
48+
new MiniCssExtractPlugin({
49+
filename: './[name].css',
50+
}),
51+
],
52+
externals: {
53+
react: {
54+
commonjs: 'react',
55+
commonjs2: 'react',
56+
amd: 'React',
57+
root: 'React',
58+
},
59+
'react-dom': {
60+
commonjs: 'react-dom',
61+
commonjs2: 'react-dom',
62+
amd: 'ReactDOM',
63+
root: 'ReactDOM',
64+
},
65+
},
6666
};

0 commit comments

Comments
 (0)