const path = require('path'); const HTMLWebpackPlugin = require('html-webpack-plugin'); module.exports = { entry: { app: path.join(__dirname, 'src/app.js'), }, output: { filename: '[name].bundle.js', chunkFilename: '[name].chunk.js', path: path.join(__dirname, 'dist'), // publicPath: "dist", }, devServer: { contentBase: './dist', // hot: true, }, devtool: 'inline-source-map', module: { rules: [ { test: /\.css$/, use: [ { loader: 'style-loader/useable', }, { loader: 'css-loader', }, ], exclude: /node_modules/, }, { test: /\.(js|jsx)$/, use: 'babel-loader', exclude: /node_modules/, }, ], }, plugins: [ new HTMLWebpackPlugin({ template: path.join(__dirname, 'src/index.html'), }), ], };
import React, { Component } from 'react'; import style from './index.css'; style.use(); let flag = true; setInterval(() => { // console.log('f', style) flag ? style.ref() : style.unref(); flag = !flag; }, 1000); class Test extends Component { render() { return (<div className="test"> this is div </div>); } } export default Test;
这里有什么问题吗,我use/ref都不行