somewind / amd-webpack-plugin Goto Github PK
View Code? Open in Web Editor NEWmake split chunks be AMD modules
License: MIT License
make split chunks be AMD modules
License: MIT License
Hi,
I tried to use this plugin with optimization.runtimeChunk
set to single
, but it doesn't work.
Thanks for the project! I tried to use this plugin in Webpack 5 using the example in the README, but unfortunately it doesn't work with the following error message:
library name must be a string for amd target
It looks to be fine in Webpack 4 though, without changing anything :)
Trying to use the plugin on below webpack config file. It generates the main chunk file just fine and then throws this function when attempting to process the vendor file. This appears to be some kind of issue at line 39 of lib/wrapper.js:
const realName = template.getAssetPath(name, {
const path = require('path')
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const AmdWebpackPlugin = require('amd-webpack-plugin');
module.exports = {
mode: "development",
bail: true,
optimization: {
splitChunks: {
chunks: 'all',
cacheGroups: {
default: false,
vendors: false,
// choose other node_modules to be vendor.js
vendor: {
name: 'vendor',
chunks: 'all',
minChunks: 1,
test: /[\\/]node_modules[\\/]/,
priority: 10
}
}
}
},
context: path.join(__dirname, "src"),
entry: {
app: "./index.js",
},
output: {
library: "[name]",
libraryTarget: 'amd',
libraryExport: 'default',
filename: "app.[contenthash].js",
path: path.join(__dirname,"build"),
devtoolModuleFilenameTemplate: '[resource-_path]',
},
plugins: [
new AmdWebpackPlugin({wrapper: 'Liferay.Loader.define' }),
new CleanWebpackPlugin({verbose: true, dry: false})
],
module: {
rules: [
{
test: /\.(js|jsx)$/i,
use: 'babel-loader',
exclude: /node_modules/
}
]
},
resolve: {
extensions: [".jsx", ".js"]
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.