I am finally attempting to upgrade my projects. I use yarn workspaces which may be part of my issue. My 2 projects build with no errors, but when launching them I get the following error. The only changes were related to webpack. Any suggestions would be greatly appreciated
Error: Template markup must be wrapped in a <template> element e.g. <template> <!-- markup here --> </template>
at Object.createTemplateFromMarkup (aurelia-pal-browser.js:480:1)
at InlineViewStrategy.loadViewFactory (aurelia-templating.js:3616:26)
at HtmlBehaviorResource.load (aurelia-templating.js:3043:1)
at aurelia-framework.js:119:66
at Array.map (<anonymous>)
at loadBehaviors (aurelia-framework.js:119:1)
at aurelia-framework.js:208:57
at next (aurelia-framework.js:24:1)
Here is my webpack config
import { AureliaPlugin } from 'aurelia-webpack-plugin';
import * as HtmlWebpackPlugin from 'html-webpack-plugin';
import * as CopyWebpackPlugin from 'copy-webpack-plugin';
import { resolve } from 'path';
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
const DashboardPlugin = require('webpack-dashboard/plugin');
const mode = process.argv.includes('--production') ? 'production' : 'development';
const analyze = process.argv.includes('--analyze');
const ensureArray = (config) => (config && (Array.isArray(config) ? config : [config])) || [];
const when = (condition, config, negativeConfig) => (condition ? ensureArray(config) : ensureArray(negativeConfig));
export = (): object => {
return {
mode: mode,
resolve: {
extensions: ['.ts', '.js'],
modules: ['src', 'node_modules', '../../node_modules'].map((p) => resolve(__dirname, '..', p)),
symlinks: false
},
entry: { app: './src/main' },
output: {
filename: '[name].js'
},
watch: mode === 'development',
devtool: mode === 'development' ? 'source-map' : 'source-map',
devServer: {
port: 8081,
historyApiFallback: true
},
optimization: {
moduleIds: 'named',
concatenateModules: false
},
module: {
rules: [
{
test: /\.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader'],
issuer: /\.[tj]s$/i
},
{
test: /\.scss$/,
use: ['css-loader', 'sass-loader'],
issuer: /\.html?$/i
},
{
test: /\.css$/i,
issuer: { not: [ /\.html$/i ] },
use: ['css-loader']
},
{
test: /\.css$/,
use: ['css-loader'],
issuer: /\.html?$/i
},
{
test: /\.[tj]s$/i,
loader: 'ts-loader',
exclude: [/node_modules/, /\.spec\.[tj]s$/]
},
{
test: /\.html$/i,
use: [
{
loader: 'html-loader',
options: {
minimize: true
}
}
]
},
{
test: /\.(png|jpg|svg|ttf|eot|woff2|woff)$/,
loader: 'url-loader'
}
]
},
plugins: [
new AureliaPlugin({ aureliaApp: undefined }),
new HtmlWebpackPlugin({
template: 'src/index.ejs',
metadata: { dev: mode !== 'production', baseUrl: "/" }
}),
...when(analyze, new BundleAnalyzerPlugin(), null),
new DashboardPlugin(),
new CopyWebpackPlugin({
patterns: [{ from: './static', to: './' }]
})
//new CopyWebpackPlugin([{ from: './static', to: './', ignore: ['.*'] }])
]
};
};