Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dva-hmr热更新问题 #887

Open
qq98424ccxy opened this issue Apr 26, 2021 · 0 comments
Open

dva-hmr热更新问题 #887

qq98424ccxy opened this issue Apr 26, 2021 · 0 comments

Comments

@qq98424ccxy
Copy link

开发过程中更新css样式,可正常实现热更新功能,
其他代码的更新则触发重启机制

"roadhog": "^2.5.0-beta.4",
"babel-plugin-dva-hmr": "^0.4.1"

.webpackrc.js文件
image

const path = require('path');
const env = require('./env');
const pkg = require('./package');
console.log(env);
const define = {
'process.env.APP_NAME': pkg.name,
};

Object.keys(env).forEach(key => {
let obj = {};
obj[process.env.${key}] = env[key];
Object.assign(define, obj);
});

export default {
entry: 'src/index.js',
extraBabelPlugins: [['import', { libraryName: 'antd', libraryDirectory: 'es', style: true }]],
env: {
development: {
extraBabelPlugins: ['dva-hmr'],
},
},
externals: {
'@antv/data-set': 'DataSet',
// rollbar: 'rollbar',
},
alias: {
components: path.resolve(__dirname, 'src/components/'),
},
ignoreMomentLocale: true,
theme: './src/theme.js',
html: {
template: './src/index.ejs',
},
lessLoaderOptions: {
javascriptEnabled: true,
},
disableDynamicImport: true,
publicPath: process.env.NODE_ENV === 'production' ? /${pkg.name}/ : '/',
hash: true,
define: define,
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant