!41 support import js in project

Merge pull request !41 from wangchun17/0914ace
This commit is contained in:
openharmony_ci
2021-09-14 11:29:43 +00:00
committed by Gitee
2 changed files with 17 additions and 10 deletions
+8 -4
View File
@@ -107,9 +107,6 @@ const webpackConfig = {
node: {
global: false,
},
resolve: {
modules: [path.join(__dirname, 'node_modules'), './node_modules'],
},
stats: 'none',
};
@@ -146,7 +143,14 @@ module.exports = (env) => {
}),
new ReturnExportsPlugin(),
]
webpackConfig.resolve = {
modules: [
process.env.projectPath,
path.join(process.env.projectPath, '../../../../../'),
path.join(__dirname, 'node_modules'),
'./node_modules'
]
}
if (fs.existsSync(path.resolve(process.env.projectPath, 'i18n'))) {
webpackConfig.plugins.push(new CopyPlugin({
patterns: [
+9 -6
View File
@@ -140,9 +140,6 @@ let config = {
node: {
global: false
},
resolve: {
modules: [path.join(__dirname, 'node_modules'), './node_modules']
},
stats: 'none'
}
@@ -191,6 +188,14 @@ module.exports = (env) => {
build: process.env.buildPath
})
]
config.resolve = {
modules: [
process.env.projectPath,
path.join(process.env.projectPath, '../../../../../'),
path.join(__dirname, 'node_modules'),
'./node_modules'
]
}
if (fs.existsSync(path.resolve(process.env.projectPath, 'i18n'))) {
config.plugins.push(new CopyPlugin({
patterns: [
@@ -237,9 +242,7 @@ module.exports = (env) => {
compress: {
unused: true
},
sourceMap: {
content: sourceMap
}
sourceMap: true
};
if (process.env.DEVICE_LEVEL === 'rich' && /\/workers\//.test(Object.keys(file)[0])) {
uglifyEsOptions.compress.unused = false;