Index.js under dist is a packaged output file. as shown in the figure, the path is very long when css is introduced. what methods can be used to optimize it
webpack.config.js
Add such a paragraph:var path = require('path'); module.exports = { entry: { ... }, output: { ... }, resolve: { root: [ path.resolve(__dirname), path.resolve(__dirname, 'public') bracket }, bracket
Then the code inside can be obtained as follows:
require('css/test.css');