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

fix #73 #74

Merged
merged 5 commits into from
Nov 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docusaurus/docs/available-scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ This will generate sourcemap files for `*.(t|j)s` which in current project.

`[email protected]` dependencies `[email protected]` and [`[email protected]`](https://github.com/webpack-contrib/terser-webpack-plugin/tree/v4.2.3#sourcemap).

> [email protected] no longer supported webpack@4. [https://github.com/webpack-contrib/terser-webpack-plugin/releases/tag/v5.0.0](https://github.com/webpack-contrib/terser-webpack-plugin/releases/tag/v5.0.0)
> [email protected] no longer supported webpack@4.x [https://github.com/webpack-contrib/terser-webpack-plugin/releases/tag/v5.0.0](https://github.com/webpack-contrib/terser-webpack-plugin/releases/tag/v5.0.0)

More Powerful ability for generating sourcemap files, please use other webpack plugins.

Expand Down
3 changes: 2 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ module.exports = {
"ts-jest": {
tsConfig: {
moduleResolution: "node",
esModuleInterop: true
esModuleInterop: true,
diagnostics: false
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/rocketact-scripts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rocketact-scripts",
"version": "1.10.1",
"version": "1.10.2",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
6 changes: 4 additions & 2 deletions packages/rocketact-scripts/src/Core.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import WebpackChain from "webpack-chain";
import WebpackChain from "webpack-chain";
import * as webpack from 'webpack';

import {
error,
appPackageJson,
Expand Down Expand Up @@ -67,7 +69,7 @@ class Core {
}
}

resolveWebpackConfig() {
resolveWebpackConfig(): unknown {
if (!this.webpackConfigResolved) {
this.applyWebpackChainFns();
this.webpackConfigResolved = true;
Expand Down
3 changes: 2 additions & 1 deletion packages/rocketact-scripts/src/CoreAPI.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Core, { webpackChainFn } from "./Core";
import * as webpack from 'webpack';

export default class CoreAPI {
private readonly core: Core;
Expand All @@ -14,7 +15,7 @@ export default class CoreAPI {
this.core.commands[name] = { fn };
}

resolveWebpackConfig() {
resolveWebpackConfig(): unknown {
return this.core.resolveWebpackConfig();
}
}
1 change: 1 addition & 0 deletions packages/rocketact-scripts/src/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export default (api: CoreAPI) => {
.then(() => {
return new Promise((resolve, reject) => {
const startTime = +new Date();
// @ts-ignore
webpack(api.resolveWebpackConfig(), (err, stats) => {
const endTime = +new Date();
const duration = ((endTime - startTime) / 1000).toFixed(2);
Expand Down
1 change: 1 addition & 0 deletions packages/rocketact-scripts/src/commands/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export default (api: CoreAPI) => {
);
}
console.log(`${infoBlock(" WAITING ")} ${info("Building...")}`);
// @ts-ignore
const compiler = webpack(webpackConfig);
const devServer = new WebpackDevServer(
// @ts-ignore
Expand Down
16 changes: 6 additions & 10 deletions packages/rocketact-scripts/src/config/webpack/plugins.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { PluginClass } from "webpack-chain";
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const ProgressBarPlugin = require("progress-bar-webpack-plugin");
const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
Expand All @@ -8,8 +9,6 @@ import createHtmlWebpackPluginInstance from "../../utils/createHtmlWebpackPlugin
import {
info,
infoBlock,
success,
successBlock,
checkPackageInstalled,
appBuild,
resolveToAppRoot,
Expand All @@ -25,13 +24,13 @@ import ConsolePlugin from "../../plugins/console";

import {
getValidEntries,
ensureTrailingSlash,
appRoot,
} from "rocketact-dev-utils";

export default (api: CoreAPI) => {
api.chainWebpack((webpackChain) => {
if (isDevelopmentEnv()) {
// @ts-ignore
webpackChain.plugin("ConsolePlugin").use(ConsolePlugin, [
{
messages: [
Expand All @@ -48,24 +47,21 @@ export default (api: CoreAPI) => {
},
]);
webpackChain
.plugin("NamedModulesPlugin")
.use(webpack.NamedModulesPlugin)
.end()
// https://webpack.js.org/migrate/4/#deprecatedremoved-plugins
.plugin("DefinePlugin")
// @ts-ignore
.use(webpack.DefinePlugin, [{ __DEV__: true }])
.end()
.plugin("NoEmitOnErrorsPlugin")
.use(webpack.NoEmitOnErrorsPlugin)
.end()
.plugin("HotModuleReplacementPlugin")
.use(webpack.HotModuleReplacementPlugin)
.end();
}

if (isProductionEnv()) {
webpackChain
// https://www.webpackjs.com/plugins/hashed-module-ids-plugin/
.plugin("HashedModuleIdsPlugin")
.use(webpack.HashedModuleIdsPlugin)
.use(new webpack.HashedModuleIdsPlugin() as PluginClass) // new (...opts: any[]): webpack.Plugin;
.end()
.plugin("MiniCssExtractPlugin")
.use(MiniCssExtractPlugin, [
Expand Down
Loading