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