Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
applied more changes
Enact-DCO-1.0-Signed-off-by: Mikyung Kim (mikyung27.kim@lge.com)
  • Loading branch information
MikyungKim committed Mar 18, 2022
commit 08121e067e3abf24d681bb967b07c7b8a9fa4230
18 changes: 11 additions & 7 deletions commands/pack.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,17 @@ function details(err, stats, output) {
process.env.CI.toLowerCase() !== 'false' &&
messages.warnings.length
) {
console.log(
chalk.yellow(
'Treating warnings as errors because process.env.CI = true. ' +
'Most CI servers set it automatically.\n'
)
);
return new Error(messages.warnings.join('\n\n'));
// Ignore sourcemap warnings in CI builds. See #8227 for more info.
const filteredWarnings = messages.warnings.filter(w => !/Failed to parse source map/.test(w));
if (filteredWarnings.length) {
console.log(
chalk.yellow(
'\nTreating warnings as errors because process.env.CI = true. \n' +
'Most CI servers set it automatically.\n'
)
);
return new Error(filteredWarnings.join('\n\n'));
}
} else {
copyPublicFolder(output);
if (messages.warnings.length) {
Expand Down
9 changes: 7 additions & 2 deletions commands/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ function devServerConfig(host, protocol, publicPath, proxy, allowedHost) {
host,
// Allow cross-origin HTTP requests
headers: {
'Access-Control-Allow-Origin': '*'
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': '*',
'Access-Control-Allow-Headers': '*'
},
static: {
// By default WebpackDevServer serves physical files from current directory
Expand Down Expand Up @@ -166,7 +168,10 @@ function devServerConfig(host, protocol, publicPath, proxy, allowedHost) {
pathname: process.env.WDS_SOCKET_PATH,
port: process.env.WDS_SOCKET_PORT
},
overlay: true
overlay: {
errors: true,
warnings: false
}
},
devMiddleware: {
// It is important to tell WebpackDevServer to use the same "publicPath" path as
Expand Down
33 changes: 23 additions & 10 deletions config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ module.exports = function (env, ilibAdditionalResourcesPath) {
options: Object.assign(
{importLoaders: preProcessor ? 2 : 1, sourceMap: shouldUseSourceMap},
cssLoaderOptions,
cssLoaderOptions.modules && {modules: {getLocalIdent}},
{
url: {
filter: url => {
Expand Down Expand Up @@ -265,6 +264,12 @@ module.exports = function (env, ilibAdditionalResourcesPath) {
// @remove-on-eject-end
module: {
rules: [
shouldUseSourceMap && {
enforce: 'pre',
exclude: /@babel(?:\/|\\{1,2})runtime/,
test: /\.(js|mjs|jsx|ts|tsx|css)$/,
loader: require.resolve('source-map-loader')
},
{
// "oneOf" will traverse all following loaders until one will
// match the requirements. When no loader matches it will fall
Expand Down Expand Up @@ -293,17 +298,21 @@ module.exports = function (env, ilibAdditionalResourcesPath) {
{
test: /\.module\.css$/,
use: getStyleLoaders({
//mode: 'local',
modules: true
modules: {
getLocalIdent,
mode: 'local'
}
})
},
{
test: /\.css$/,
// The `forceCSSModules` Enact build option can be set true to universally apply
// modular CSS support.
use: getStyleLoaders({
//mode: 'icss',
modules: app.forceCSSModules
modules: {
...(app.forceCSSModules ? {getLocalIdent} : {}),
mode: 'icss'
}
}),
// Don't consider CSS imports dead code even if the
// containing package claims to have no side effects.
Expand All @@ -314,15 +323,19 @@ module.exports = function (env, ilibAdditionalResourcesPath) {
{
test: /\.module\.less$/,
use: getLessStyleLoaders({
//mode: 'local',
modules: true
modules: {
getLocalIdent,
mode: 'local'
}
})
},
{
test: /\.less$/,
use: getLessStyleLoaders({
//mode: 'icss',
modules: app.forceCSSModules
modules: {
...(app.forceCSSModules ? {getLocalIdent} : {}),
mode: 'icss'
}
}),
sideEffects: true
},
Expand All @@ -343,7 +356,7 @@ module.exports = function (env, ilibAdditionalResourcesPath) {
// Make sure to add the new loader(s) before the "file" loader.
]
}
]
].filter(Boolean)
},
// Specific webpack-dev-server options.
devServer: {
Expand Down
Loading