@lightscale/webpack-config 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +106 -6
- package/package.json +1 -1
- package/lightscale-webpack-config-1.0.4.tgz +0 -0
package/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import EsLintPlugin from 'eslint-webpack-plugin';
|
|
|
7
7
|
import WebpackbarPlugin from 'webpackbar';
|
|
8
8
|
import CleanTerminalPlugin from 'clean-terminal-webpack-plugin';
|
|
9
9
|
import {CleanWebpackPlugin} from 'clean-webpack-plugin';
|
|
10
|
+
import Autoprefixer from 'autoprefixer';
|
|
10
11
|
|
|
11
12
|
export class Paths {
|
|
12
13
|
#jsSourcePath;
|
|
@@ -28,11 +29,99 @@ export class Paths {
|
|
|
28
29
|
}
|
|
29
30
|
};
|
|
30
31
|
|
|
32
|
+
const babelConfig = {
|
|
33
|
+
presets: [
|
|
34
|
+
"@babel/preset-env"
|
|
35
|
+
],
|
|
36
|
+
plugins: [
|
|
37
|
+
["polyfill-corejs3", { method: "usage-global"}]
|
|
38
|
+
],
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const postCssConfig = {
|
|
42
|
+
plugins: [
|
|
43
|
+
Autoprefixer
|
|
44
|
+
]
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const esLintConfig = {
|
|
48
|
+
'root': true,
|
|
49
|
+
'extends': [
|
|
50
|
+
'eslint:recommended'
|
|
51
|
+
],
|
|
52
|
+
'globals': {
|
|
53
|
+
'wp': true,
|
|
54
|
+
},
|
|
55
|
+
'env': {
|
|
56
|
+
'node': true,
|
|
57
|
+
'es6': true,
|
|
58
|
+
'amd': true,
|
|
59
|
+
'browser': true,
|
|
60
|
+
'jquery': true,
|
|
61
|
+
},
|
|
62
|
+
'parser': '@babel/eslint-parser',
|
|
63
|
+
'parserOptions': {
|
|
64
|
+
'ecmaFeatures': {
|
|
65
|
+
'globalReturn': true,
|
|
66
|
+
'generators': false,
|
|
67
|
+
'objectLiteralDuplicateProperties': false,
|
|
68
|
+
'experimentalObjectRestSpread': true,
|
|
69
|
+
},
|
|
70
|
+
'ecmaVersion': 2017,
|
|
71
|
+
'sourceType': 'module',
|
|
72
|
+
'requireConfigFile': false,
|
|
73
|
+
},
|
|
74
|
+
'plugins': [
|
|
75
|
+
|
|
76
|
+
],
|
|
77
|
+
'settings': {
|
|
78
|
+
'import/core-modules': [],
|
|
79
|
+
'import/ignore': [
|
|
80
|
+
'node_modules',
|
|
81
|
+
'\\.(coffee|scss|css|less|hbs|svg|json)$',
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
'rules': {
|
|
85
|
+
'no-console': 0,
|
|
86
|
+
'quotes': ['error', 'single'],
|
|
87
|
+
'semi': ['warn', 'always'],
|
|
88
|
+
'comma-dangle': 0,
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const styleLintConfig = {
|
|
93
|
+
'extends': 'stylelint-config-standard',
|
|
94
|
+
'plugins': ['stylelint-scss'],
|
|
95
|
+
'customSyntax': 'postcss-scss',
|
|
96
|
+
'rules': {
|
|
97
|
+
'no-empty-source': null,
|
|
98
|
+
//'selector-id-pattern': null,
|
|
99
|
+
'selector-class-pattern': null, // TODO: remove and fix
|
|
100
|
+
'at-rule-no-unknown': null,
|
|
101
|
+
'function-no-unknown': null,
|
|
102
|
+
'no-invalid-position-at-import-rule': [
|
|
103
|
+
true,
|
|
104
|
+
{
|
|
105
|
+
ignoreAtRules: ["/^use$/"]
|
|
106
|
+
}
|
|
107
|
+
],
|
|
108
|
+
'scss/at-rule-no-unknown': true,
|
|
109
|
+
'import-notation': null,
|
|
110
|
+
'annotation-no-unknown': null,
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
|
|
31
115
|
export const makeConfig = (env, argv, options) => {
|
|
32
116
|
const isProd = argv.mode === 'production',
|
|
33
117
|
isDev = argv.mode === 'development',
|
|
34
118
|
isWatch = typeof argv.watch !== 'undefined' && argv.watch === true,
|
|
35
|
-
{paths,
|
|
119
|
+
{paths,
|
|
120
|
+
entry,
|
|
121
|
+
plugins = [],
|
|
122
|
+
manifestCustomize = (e) => e,
|
|
123
|
+
sassOptions = {}
|
|
124
|
+
} = options;
|
|
36
125
|
|
|
37
126
|
return {
|
|
38
127
|
entry,
|
|
@@ -75,8 +164,10 @@ export const makeConfig = (env, argv, options) => {
|
|
|
75
164
|
}),
|
|
76
165
|
new StylelintPlugin({
|
|
77
166
|
failOnError: !isWatch,
|
|
167
|
+
config: styleLintConfig,
|
|
78
168
|
}),
|
|
79
169
|
new EsLintPlugin({
|
|
170
|
+
baseConfig: esLintConfig,
|
|
80
171
|
overrideConfig: {
|
|
81
172
|
rules: {
|
|
82
173
|
"no-console": isProd ? 2 : 1,
|
|
@@ -101,9 +192,10 @@ export const makeConfig = (env, argv, options) => {
|
|
|
101
192
|
{
|
|
102
193
|
test: /\.js$/i,
|
|
103
194
|
include: paths.sourcePath,
|
|
104
|
-
use:
|
|
105
|
-
'babel-loader'
|
|
106
|
-
|
|
195
|
+
use: {
|
|
196
|
+
loader: 'babel-loader',
|
|
197
|
+
options: babelConfig,
|
|
198
|
+
}
|
|
107
199
|
},
|
|
108
200
|
{
|
|
109
201
|
test: /\.s[ac]ss$/i,
|
|
@@ -111,8 +203,16 @@ export const makeConfig = (env, argv, options) => {
|
|
|
111
203
|
use: [
|
|
112
204
|
MiniCssExtractPlugin.loader,
|
|
113
205
|
'css-loader',
|
|
114
|
-
|
|
115
|
-
|
|
206
|
+
{
|
|
207
|
+
loader: 'postcss-loader',
|
|
208
|
+
options: {
|
|
209
|
+
postcssOptions: postCssConfig
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
loader: 'sass-loader',
|
|
214
|
+
options: sassOptions,
|
|
215
|
+
},
|
|
116
216
|
],
|
|
117
217
|
},
|
|
118
218
|
],
|
package/package.json
CHANGED
|
Binary file
|