I want be able to import in any file in my project the two types of files.
import 'styles/index.scss';
import 'styles/build/_style.css'
Its important to note im using Nextjs 7 and webpack 4 (comes with nextjs7)
In Nextjs 6 we used to use in next.config.js
const withCSS = require('@zeit/next-css')
const withSass = require('@zeit/next-sass')
const commonsChunkConfig = (config, test = /\.css$/) => {
config.plugins = config.plugins.map(plugin => {
if (
plugin.constructor.name === 'CommonsChunkPlugin' &&
plugin.minChunks != null
) {
const defaultMinChunks = plugin.minChunks;
plugin.minChunks = (module, count) => {
if (module.resource && module.resource.match(test)) {
return true;
}
return defaultMinChunks(module, count);
};
}
return plugin;
});
return config;
};
module.exports = withCSS(withSass({
webpack: (config, { isServer }) => {
config = commonsChunkConfig(config, /\.(sass|scss|css)$/)
return config
}
}))