diff --git a/rspack/moment-js/index.html b/rspack/moment-js/index.html new file mode 100644 index 00000000..ae516aa1 --- /dev/null +++ b/rspack/moment-js/index.html @@ -0,0 +1,12 @@ + + + + + + + + +
+ + + diff --git a/rspack/moment-js/index.js b/rspack/moment-js/index.js new file mode 100644 index 00000000..c11997a0 --- /dev/null +++ b/rspack/moment-js/index.js @@ -0,0 +1,2 @@ +const moment = require('moment'); +moment().format(); diff --git a/rspack/moment-js/package.json b/rspack/moment-js/package.json new file mode 100644 index 00000000..2faf13f4 --- /dev/null +++ b/rspack/moment-js/package.json @@ -0,0 +1,19 @@ +{ + "name": "example-monaco-editor-js", + "version": "1.0.0", + "private": true, + "main": "index.js", + "scripts": { + "dev": "rspack serve", + "build": "rspack build" + }, + "license": "MIT", + "dependencies": { + "moment": "^2.30.1" + }, + "devDependencies": { + "@rspack/cli": "latest", + "@rspack/core": "latest", + "moment-locales-webpack-plugin": "^1.2.0" + } +} diff --git a/rspack/moment-js/rspack.config.js b/rspack/moment-js/rspack.config.js new file mode 100644 index 00000000..129b6ccb --- /dev/null +++ b/rspack/moment-js/rspack.config.js @@ -0,0 +1,30 @@ +const rspack = require("@rspack/core"); +const path = require("path"); +const MomentLocalesPlugin = require('moment-locales-webpack-plugin'); + +module.exports = { + entry: { + app: "./index.js" + }, + output: { + globalObject: "self", + filename: "[name].bundle.js", + path: path.resolve(__dirname, "dist") + }, + module: { + rules: [ + { + test: /\.ttf$/, + type: "asset/resource" + } + ] + }, + plugins: [ + new rspack.HtmlRspackPlugin({ + template: "./index.html" + }), + new MomentLocalesPlugin({ + localesToKeep: ['es-us', 'ru'], + }), + ] +};