webpack-5

css-loadel - how to correct use with webpack 5

回眸只為那壹抹淺笑 提交于 2021-01-29 13:56:15
问题 I have some files. Webpack config { test: cssModuleRegex, use: [ { loader: 'style-loader' }, { loader: 'css-loader', options: { modules: true, } }, ] }, main.module.scss .page { height: 100vh; display: flex; align-items: center; justify-content: center; } and i use it in react component as css-module import styles from './main.module.scss'; export class Main extends PureComponent<Props> { render() { return ( <div className={ styles.page }> <Logo /> </div> ); } } But it doesn't work If i

Module parse failed: Unexpected character '@' (1:0) with Storybook 6.1.11, Webpack 5.11.0, React 17.0.1

丶灬走出姿态 提交于 2021-01-06 03:40:58
问题 Trying to setup a react-app with all latest versions. Github Repo Link Trying to run storybook with sass file imported will result in below error. Trying to run without importing the styles, storybook works. The same code works correctly when its run as npm start run with no warnings and errors. I have configured css modules using @dr.pogodin/babel-plugin-react-css-modules with sass, webpack 5, react 17 and with latest packages. ERROR in ./src/assets/stylesheets/app.scss 1:0 Module parse

After build via Webpack 5 app stoped working on Internet Explorer (IE11)

依然范特西╮ 提交于 2020-12-15 06:09:01
问题 As announced in Webpacks 5.0 release blog post build still works in most browsers after a few minor adjustments in webpack.config.js . But it stopped working in Internet Explorer (11) because the generated output is mixed ES6 and ES5 and therefore incompatible with IE (see image). As it actually leads to no successful build using a variety of babel plugins I'm asking myself if theres an "easy" way to specify ES5 as the generated output. From beta phase of webpack-5 I found a flag on Medium

After build via Webpack 5 app stoped working on Internet Explorer (IE11)

删除回忆录丶 提交于 2020-12-15 06:07:01
问题 As announced in Webpacks 5.0 release blog post build still works in most browsers after a few minor adjustments in webpack.config.js . But it stopped working in Internet Explorer (11) because the generated output is mixed ES6 and ES5 and therefore incompatible with IE (see image). As it actually leads to no successful build using a variety of babel plugins I'm asking myself if theres an "easy" way to specify ES5 as the generated output. From beta phase of webpack-5 I found a flag on Medium

Webpack 5: devtool ValidationError, invalid configuration object

别说谁变了你拦得住时间么 提交于 2020-12-09 07:16:20
问题 While migrating from Webpack 4 to Webpack 5 I got an error when using devtool with empty value (only in production mode). module.exports = { devtool: isProd ? '' : 'source-map', // entry: ... // output: ... // module: ... } The message in the console: ValidationError: Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. - configuration.devtool should match pattern "^(inline-|hidden-|eval-)?(nosources-)?(cheap-(module-)?)