配置小程序 webpack
This commit is contained in:
parent
f8f8eaffc4
commit
c62268a51b
|
|
@ -41,7 +41,7 @@ module.exports = {
|
|||
appIndexJs: resolveModule(resolveApp, 'src/app'),
|
||||
appPackageJson: resolveRoot('package.json'),
|
||||
appSrc: resolveApp('src'),
|
||||
appTsConfig: resolveRoot('tsconfig.json'),
|
||||
appTsConfig: resolveRoot('tsconfig.mp.json'),
|
||||
appJsConfig: resolveRoot('jsconfig.json'),
|
||||
yarnLockFile: resolveRoot('yarn.lock'),
|
||||
appNodeModules: resolveRoot('node_modules'),
|
||||
|
|
@ -49,6 +49,7 @@ module.exports = {
|
|||
appTsBuildInfoFile: resolveRoot('node_modules/.cache/tsconfig.tsbuildinfo'),
|
||||
publicUrlOrPath: '/',
|
||||
appOutSrc: resolveRoot('src'),
|
||||
appOutPath: resolveRoot('.'),
|
||||
oakConfigJson: resolveRoot('oak.config.json'),
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -73,6 +73,19 @@ module.exports = function (webpackEnv) {
|
|||
};
|
||||
};
|
||||
|
||||
const getOakInclude = () => {
|
||||
return isEnvProduction
|
||||
? [/oak-general-business/]
|
||||
: [
|
||||
/oak-domain/,
|
||||
/oak-external-sdk/,
|
||||
/oak-frontend-base/,
|
||||
/oak-general-business/,
|
||||
/oak-memory-tree-store/,
|
||||
/oak-common-aspect/,
|
||||
];
|
||||
};
|
||||
|
||||
return {
|
||||
context: paths.appSrc,
|
||||
devtool: isEnvDevelopment ? 'source-map' : false,
|
||||
|
|
@ -218,17 +231,27 @@ module.exports = function (webpackEnv) {
|
|||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
include: [paths.appSrc, paths.appOutSrc].concat(
|
||||
getOakInclude()
|
||||
),
|
||||
exclude: /node_modules/,
|
||||
loader: 'babel-loader',
|
||||
},
|
||||
{
|
||||
test: /\.ts$/,
|
||||
test: /\.((?!tsx)ts)$/,
|
||||
include: [paths.appSrc, paths.appOutSrc].concat(
|
||||
getOakInclude()
|
||||
),
|
||||
exclude: /node_modules/,
|
||||
loader: 'ts-loader',
|
||||
options: {
|
||||
configFile: paths.appTsConfig,
|
||||
context: paths.appOutPath,
|
||||
},
|
||||
},
|
||||
// {
|
||||
// test: /\.json$/,
|
||||
// include: /src/,
|
||||
// include: paths.appSrc,
|
||||
// exclude: /node_modules/,
|
||||
// type: 'asset/resource',
|
||||
// generator: {
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ module.exports = {
|
|||
appIndexJs: resolveModule(resolveApp, 'src/index'),
|
||||
appPackageJson: resolveRoot('package.json'),
|
||||
appSrc: resolveApp('src'),
|
||||
appTsConfig: resolveRoot('tsconfig.json'),
|
||||
appTsConfig: resolveRoot('tsconfig.web.json'),
|
||||
appJsConfig: resolveRoot('jsconfig.json'),
|
||||
yarnLockFile: resolveRoot('yarn.lock'),
|
||||
testsSetup: resolveModule(resolveApp, 'src/setupTests'),
|
||||
|
|
@ -73,6 +73,7 @@ module.exports = {
|
|||
swSrc: resolveModule(resolveApp, 'src/service-worker'),
|
||||
publicUrlOrPath,
|
||||
appOutSrc: resolveRoot('src'),
|
||||
appOutPath: resolveRoot('.'),
|
||||
oakConfigJson: resolveRoot('oak.config.json'),
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue