ERROR Error: [copy-webpack-plugin] patterns must be an array
When installing mars3d, you need to install the copy webpack plugin plug-in
and then configure it in vue.config.js report an error: Error: error: [copy webpack plugin] patterns must be an array
the current node version is 12.2.0
const plugins = [
// Identifies the home directory where cesium resources are located, which is needed for resource loading, multithreading, etc. inside cesium
new webpack.DefinePlugin({
CESIUM_BASE_URL: JSON.stringify(path.join(config.output.publicPath, cesiumRunPath))
}),
// Cesium-related resource directories need to be copied to the system directory (some CopyWebpackPlugin versions may not have patterns in their syntax)
new CopyWebpackPlugin({
patterns: [
{ from: path.join(cesiumSourcePath, 'Workers'), to: path.join(config.output.path, cesiumRunPath, 'Workers') },
{ from: path.join(cesiumSourcePath, 'Assets'), to: path.join(config.output.path, cesiumRunPath, 'Assets') },
{ from: path.join(cesiumSourcePath, 'ThirdParty'), to: path.join(config.output.path, cesiumRunPath, 'ThirdParty') },
{ from: path.join(cesiumSourcePath, 'Widgets'), to: path.join(config.output.path, cesiumRunPath, 'Widgets') }
]
})
];
new CopyWebpackPlugin is changed as follows:
const plugins = [
// Identifies the home directory where cesium resources are located, which is needed for resource loading, multithreading, etc. within cesium
new webpack.DefinePlugin({
CESIUM_BASE_URL: JSON.stringify(path.join(config.output.publicPath, cesiumRunPath))
}),
new CopyWebpackPlugin([
{ from: path.join(cesiumSourcePath, 'Workers'), to: path.join(config.output.path, cesiumRunPath, 'Workers') },
{ from: path.join(cesiumSourcePath, 'Assets'), to: path.join(config.output.path, cesiumRunPath, 'Assets') },
{ from: path.join(cesiumSourcePath, 'ThirdParty'), to: path.join(config.output.path, cesiumRunPath, 'ThirdParty') },
{ from: path.join(cesiumSourcePath, 'Widgets'), to: path.join(config.output.path, cesiumRunPath, 'Widgets') }
])
];
Run successfully
Read More:
- [Solved] error TS1086: An accessor cannot be declared in an ambient context
- The body of a for-in should be wrapped in an if statement to filter unwanted properties from the pro
- Special JSON array of special bracket
- Using for in loop complex data types (object and array) in ES6
- Vue3.0 error: Failed to resolve component el-form-item (el element to be unable to be displayed)
- After Vue is packaged to the server, the static resource path reports an error
- [Modified] svg loader Error: Plugin name should be specified
- [Solved] Vue3 Configuration routing error: Catch all routes (“*“) must now be defined using a param with a custom regexp.
- [ERR_INVALID_ARG_TYPE]: The “path“ argument must be of type string. Received undefined error
- After installing NPM, NRM LS reports an error throw new err_INVALID_ARG_TYPE(name, ‘string‘, value)
- [Solved] Component name “login“ should always be multi-word.
- “Failed to load resource: net::ERR_FILE_NOT_FOUND” error. The project created by vue-cli 3.0 can run under dev, and an error is reported after packaging, and the page is blank.
- [Solved] Vue eslint Error: Component name “*****“ should always be multi-word
- After Vite starts, it will prompt “network: use ` — host ` to expose”, and the service cannot be accessed through network IP
- [Solved] VUE eslint Error: Expected linebreaks to be ‘LF‘ but found ‘CRLF
- [Solved] ESlint Create New File Error: Component name “Home” should always be multi-word.
- Element-plus Warning: ElementPlusError: [Util] binding value must be a string or number.
- How to Solve VUE Error: Avoid mutating a prop directly since the value will be overwritten …
- [Solved] “npm WARN logfile could not be created: Error: EPERM: operation not permitted,…”
- [Solved] error when starting dev server:Error: The following dependencies are imported but could not be reso