mirror of
https://github.com/qlik-oss/nebula.js.git
synced 2025-12-19 17:58:43 -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;
|
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 {
|
return {
|
||||||
input: {
|
input: {
|
||||||
onwarn(warning, warn) {
|
onwarn(warning, warn) {
|
||||||
@@ -163,30 +189,28 @@ const config = ({
|
|||||||
browser,
|
browser,
|
||||||
preferBuiltins,
|
preferBuiltins,
|
||||||
}),
|
}),
|
||||||
|
postcss({
|
||||||
|
exclude: /\.module\.css$/,
|
||||||
|
}),
|
||||||
|
postcss({
|
||||||
|
include: /\.module\.css$/,
|
||||||
|
modules: true,
|
||||||
|
extract: true,
|
||||||
|
}),
|
||||||
commonjs({
|
commonjs({
|
||||||
ignoreTryCatch: false, // Avoids problems with require() inside try catch (https://github.com/rollup/plugins/issues/1004)
|
ignoreTryCatch: false, // Avoids problems with require() inside try catch (https://github.com/rollup/plugins/issues/1004)
|
||||||
}),
|
}),
|
||||||
json(),
|
json(),
|
||||||
|
// Handle all CSS with conditional modules processing
|
||||||
|
|
||||||
babel({
|
babel({
|
||||||
babelHelpers: 'bundled',
|
babelHelpers: 'bundled',
|
||||||
babelrc: false,
|
babelrc: false,
|
||||||
inputSourceMap: sourcemap,
|
inputSourceMap: sourcemap,
|
||||||
extensions,
|
extensions,
|
||||||
presets: [
|
presets: babelPresets,
|
||||||
[
|
|
||||||
babelPreset,
|
|
||||||
{
|
|
||||||
modules: false,
|
|
||||||
targets: {
|
|
||||||
browsers: ['chrome 62'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
],
|
|
||||||
plugins: [[jsxPlugin]],
|
plugins: [[jsxPlugin]],
|
||||||
}),
|
}),
|
||||||
postcss({}),
|
|
||||||
...[typescript ? typescriptPlugin() : false],
|
|
||||||
...[
|
...[
|
||||||
mode === 'production'
|
mode === 'production'
|
||||||
? terser({
|
? terser({
|
||||||
|
|||||||
Reference in New Issue
Block a user