mirror of
https://github.com/qlik-oss/nebula.js.git
synced 2025-12-19 09:48:18 -05:00
fix: try support css modules (#1808)
* fix: try support css modules * fix: non-ts builds failed * fix: regular css imports processing * fix: regular css imports processing * fix: support both module css and regular
This commit is contained in:
@@ -140,6 +140,32 @@ const config = ({
|
||||
return outputConfig;
|
||||
};
|
||||
|
||||
const babelPresets = [
|
||||
[
|
||||
babelPreset,
|
||||
{
|
||||
modules: false,
|
||||
targets: {
|
||||
browsers: ['chrome 62'],
|
||||
},
|
||||
},
|
||||
],
|
||||
['@babel/preset-react'],
|
||||
];
|
||||
|
||||
if (typescript) {
|
||||
babelPresets.push([
|
||||
'@babel/preset-typescript',
|
||||
{
|
||||
allowNamespaces: true,
|
||||
allowDeclareFields: true,
|
||||
onlyRemoveTypeImports: true,
|
||||
// Fixes for _default issues
|
||||
isolatedModules: true,
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
return {
|
||||
input: {
|
||||
onwarn(warning, warn) {
|
||||
@@ -163,30 +189,28 @@ const config = ({
|
||||
browser,
|
||||
preferBuiltins,
|
||||
}),
|
||||
postcss({
|
||||
exclude: /\.module\.css$/,
|
||||
}),
|
||||
postcss({
|
||||
include: /\.module\.css$/,
|
||||
modules: true,
|
||||
extract: true,
|
||||
}),
|
||||
commonjs({
|
||||
ignoreTryCatch: false, // Avoids problems with require() inside try catch (https://github.com/rollup/plugins/issues/1004)
|
||||
}),
|
||||
json(),
|
||||
// Handle all CSS with conditional modules processing
|
||||
|
||||
babel({
|
||||
babelHelpers: 'bundled',
|
||||
babelrc: false,
|
||||
inputSourceMap: sourcemap,
|
||||
extensions,
|
||||
presets: [
|
||||
[
|
||||
babelPreset,
|
||||
{
|
||||
modules: false,
|
||||
targets: {
|
||||
browsers: ['chrome 62'],
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
presets: babelPresets,
|
||||
plugins: [[jsxPlugin]],
|
||||
}),
|
||||
postcss({}),
|
||||
...[typescript ? typescriptPlugin() : false],
|
||||
...[
|
||||
mode === 'production'
|
||||
? terser({
|
||||
|
||||
Reference in New Issue
Block a user