@iam-com/snack-scripts 1.0.0 → 1.0.1
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/README.md +1 -1
- package/config/webpack.dev.config.js +1 -0
- package/config/webpack.loader.config.js +14 -11
- package/config/webpack.snack.config.js +22 -43
- package/package.json +1 -1
- package/utils/package.js +3 -3
package/README.md
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
# 1.0.
|
|
1
|
+
# 1.0.1
|
|
2
2
|
基于产品2.3.7
|
|
@@ -51,9 +51,11 @@ let conf = {
|
|
|
51
51
|
rules: [
|
|
52
52
|
{
|
|
53
53
|
test: /\.(ts|tsx|js|jsc|cjs)?$/,
|
|
54
|
+
exclude: /node_modules/,
|
|
54
55
|
loader: 'swc-loader',
|
|
55
56
|
options: {
|
|
56
57
|
sync: true,
|
|
58
|
+
inputSourceMap: false,
|
|
57
59
|
jsc: {
|
|
58
60
|
parser: {
|
|
59
61
|
'syntax': 'typescript',
|
|
@@ -108,18 +110,19 @@ let conf = {
|
|
|
108
110
|
}
|
|
109
111
|
)
|
|
110
112
|
]
|
|
111
|
-
}
|
|
113
|
+
},
|
|
114
|
+
ignoreWarnings: [/failed to read input source map/]
|
|
112
115
|
};
|
|
113
116
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
117
|
+
const configOverrides = path.resolve(process.env.PROJECT_PATH, 'config-overrides.js');
|
|
118
|
+
if (fs.existsSync(configOverrides)) {
|
|
119
|
+
try {
|
|
120
|
+
const overrides = require(path.resolve(process.env.PROJECT_PATH, 'config-overrides.js'));
|
|
121
|
+
conf = overrides(conf);
|
|
122
|
+
console.log('snack config overrides');
|
|
123
|
+
} catch (err) {
|
|
124
|
+
console.error('SnackCLI Error:', err);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
124
127
|
|
|
125
128
|
module.exports = conf;
|
|
@@ -38,10 +38,6 @@ for (let i = 0, l = packageList.length; i < l; i++) {
|
|
|
38
38
|
const externals = createExternals(packageJson, packagePath)
|
|
39
39
|
|
|
40
40
|
let conf = {
|
|
41
|
-
cache: {
|
|
42
|
-
type: 'filesystem',
|
|
43
|
-
allowCollectingMemory: true
|
|
44
|
-
},
|
|
45
41
|
mode: isDevelopment ? 'development' : 'production',
|
|
46
42
|
target: ['web', 'es5'],
|
|
47
43
|
entry: entrys,
|
|
@@ -61,24 +57,33 @@ let conf = {
|
|
|
61
57
|
new SnackPlugin()
|
|
62
58
|
],
|
|
63
59
|
// 过滤依赖包
|
|
64
|
-
externals:
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
60
|
+
externals: [
|
|
61
|
+
{
|
|
62
|
+
'react': 'react',
|
|
63
|
+
'react-dom': 'react-dom',
|
|
64
|
+
'para-lib': 'para-lib',
|
|
65
|
+
'@iam-com/lib': '@iam-com/lib',
|
|
66
|
+
'@iam-com/lib/http': '@iam-com/lib',
|
|
67
|
+
'@iam-com/lib/esso': '@iam-com/lib',
|
|
68
|
+
'@iam-com/lib/ui': '@iam-com/lib',
|
|
69
|
+
'@iam-com/lib/utils': '@iam-com/lib',
|
|
70
|
+
'@iam-com/snack-core': 'snack-core',
|
|
71
|
+
...externals
|
|
72
|
+
},
|
|
73
|
+
function({ context, request }, callback) {
|
|
74
|
+
if (request.startsWith('@iam-com/ui-core') || request.startsWith('@iam-com/icons')) {
|
|
75
|
+
return callback(null, request);
|
|
76
|
+
}
|
|
77
|
+
callback();
|
|
78
|
+
}
|
|
79
|
+
],
|
|
76
80
|
// loader配置
|
|
77
81
|
module: {
|
|
78
82
|
rules: [
|
|
79
83
|
{
|
|
80
|
-
test: /\.(ts|tsx|js|jsc
|
|
84
|
+
test: /\.(ts|tsx|js|jsc)?$/,
|
|
81
85
|
loader: 'swc-loader',
|
|
86
|
+
exclude: /node_modules/,
|
|
82
87
|
options: {
|
|
83
88
|
sync: true,
|
|
84
89
|
jsc: {
|
|
@@ -92,32 +97,6 @@ let conf = {
|
|
|
92
97
|
}
|
|
93
98
|
}
|
|
94
99
|
},
|
|
95
|
-
{
|
|
96
|
-
test: /\.(ts|tsx|js|jsc)?$/, // 或其他你想要Babel处理的文件类型
|
|
97
|
-
include: [path.resolve(__dirname, 'src')], // 指定需要Babel处理的目录
|
|
98
|
-
use: [
|
|
99
|
-
{
|
|
100
|
-
loader: 'babel-loader',
|
|
101
|
-
options: {
|
|
102
|
-
presets: [
|
|
103
|
-
['@babel/preset-env'],
|
|
104
|
-
['@babel/preset-react'],
|
|
105
|
-
['@babel/preset-typescript']
|
|
106
|
-
], // 添加对 TypeScript 的支持
|
|
107
|
-
plugins: [
|
|
108
|
-
[
|
|
109
|
-
'import',
|
|
110
|
-
{
|
|
111
|
-
libraryName: '@iam-com/ui-core',
|
|
112
|
-
libraryDirectory: '.', // 或者是根目录 '.',根据你的库结构调整
|
|
113
|
-
},
|
|
114
|
-
'ParaUI', // 可选命名空间
|
|
115
|
-
],
|
|
116
|
-
],
|
|
117
|
-
},
|
|
118
|
-
}
|
|
119
|
-
]
|
|
120
|
-
},
|
|
121
100
|
{
|
|
122
101
|
test: /\.vue$/,
|
|
123
102
|
exclude: /node_modules/,
|
package/package.json
CHANGED
package/utils/package.js
CHANGED
|
@@ -178,7 +178,7 @@ module.exports.injectIndexFile = (templatePath, hook) => {
|
|
|
178
178
|
|
|
179
179
|
module.exports.createExternals = (packageJson, packagePath) => {
|
|
180
180
|
const externals = packageJson.snack && packageJson.snack.externals || {};
|
|
181
|
-
if (externals['@
|
|
181
|
+
if (externals['@iam-com/ui-core'] === 'all') {
|
|
182
182
|
const corePath = path.join(packagePath, 'node_modules/@iam-com/ui-core');
|
|
183
183
|
const coreList = fs.readdirSync(corePath);
|
|
184
184
|
for (let i = 0, l = coreList.length; i < l; i++) {
|
|
@@ -186,12 +186,12 @@ module.exports.createExternals = (packageJson, packagePath) => {
|
|
|
186
186
|
if (!fs.statSync(path.join(corePath, name)).isDirectory()) continue;
|
|
187
187
|
externals[`@iam-com/ui-core/${name}`] = `@iam-com/ui-core/${name}`;
|
|
188
188
|
}
|
|
189
|
-
const iconsPath = path.join(packagePath, 'node_modules/@
|
|
189
|
+
const iconsPath = path.join(packagePath, 'node_modules/@iam-com/icons');
|
|
190
190
|
const iconsList = fs.readdirSync(iconsPath);
|
|
191
191
|
for (let i = 0, l = iconsList.length; i < l; i++) {
|
|
192
192
|
const name = iconsList[i];
|
|
193
193
|
if (!fs.statSync(path.join(iconsPath, name)).isDirectory()) continue;
|
|
194
|
-
externals[`@
|
|
194
|
+
externals[`@iam-com/icons/${name}`] = `@iam-com/icons/${name}`;
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
return externals;
|