Unexpected marker error when using aurelia-webpack-plugin during webpack build

Library Version: aurelia-webpack-plugin@2.0.0-rc.1 (Industry: v2.0)

Operating system: Windows 8 Node Version: 6.7.0 NPM version: 3.10.8 Webpack version webpack 2.2.1 Browser: all Language: TypeScript 2.1 Current behavior:

If we use aurelia-webpack-plugin in the webpack configuration file, we get an error during the webpack build process. The error indicates that "SyntaxError: Unexpected token ="

enter image description here

package.json

     "dependencies": {
    "aurelia-bootstrapper-webpack": "^1.0.0",
    "aurelia-event-aggregator": "^1.0.0",
    "aurelia-framework": "^1.0.1",
    "aurelia-history-browser": "^1.0.0",
    "aurelia-loader-webpack": "^1.0.2",
    "aurelia-logging-console": "^1.0.0",
    "aurelia-templating-binding": "^1.0.0",
    "aurelia-templating-resources": "^1.0.0",
    "aurelia-templating-router": "^1.0.0"
  },
  "devDependencies": {
    "aurelia-webpack-plugin": "git+https://github.com/aurelia/webpack-plugin.git#v2.0",
    "html-loader": "^0.4.3",
    "source-map-loader": "^0.1.5",
    "webpack": "^2.2.1"
  }

tsconfig.json

    {
  "compilerOptions": {
    "target": "es5",
    "module": "amd",   
    "experimentalDecorators": true,
    "strictNullChecks": true,
    "moduleResolution": "node",
    "sourceMap": true,    
    "lib": [
      "es2017",
      "dom"
    ]
  },
  "awesomeTypescriptLoaderOptions": {
    "forkChecker": true
  },
  "exclude": [
    "node_modules",
    "build"  
  ]
}

webpack.config.js

const AureliaWebpackPlugin = require('aurelia-webpack-plugin');
var path = require('path');
// We need this to use the CommonsChunkPlugin.
var webpack = require('webpack');

const baseUrl = '/';
const rootDir = path.resolve();
const srcDir = path.resolve('src');
const outDir = path.resolve('build');


module.exports = {
    entry: {
        // Our app entry point, this is set automatically by aurelia-webpack-plugin
        // using the files in the "src" folder that we're still going to create.
        // The app knows which of the files is our entry point because of the "aurelia-bootstrapper-webpack" 
        // who reads the entry point from the aurelia-app="main" in our index.html.
        'app': [],       
        //These are all the aurelia libraries, they will be bundled separately from our app main code.
        //I tried to bundle everything together, with no success.
        'aurelia': [
            'aurelia-bootstrapper-webpack',
            'aurelia-polyfills',
            'aurelia-pal',
            'aurelia-pal-browser',
            'aurelia-binding',
            'aurelia-dependency-injection',
            'aurelia-event-aggregator',
            'aurelia-framework',
            'aurelia-history',
            'aurelia-history-browser',
            'aurelia-loader',
            'aurelia-loader-webpack',
            'aurelia-logging',
            'aurelia-logging-console',
            'aurelia-metadata',
            'aurelia-path',
            'aurelia-route-recognizer',
            'aurelia-router',
            'aurelia-task-queue',
            'aurelia-templating',
            'aurelia-templating-binding',
            'aurelia-templating-router',
            'aurelia-templating-resources'
        ]
    },
   // entry: 'main',
    output: {
        //This is the folder where our packed app will be after we run webpack.
        path: './build',
        filename: 'scripts/[name].bundle.js',
        sourceMapFilename: 'scripts/[name].bundle.js.map'
    },   
   // devtool: 'source-map',
    module: {

        loaders: [
            { test: /\.html$/, use: 'html-loader'},
            { test: /\.json$/, use: 'json-loader'} 
        ]
    },
    plugins: [

        new AureliaWebpackPlugin({
            root: rootDir,
            src: srcDir,           
            baseUrl: baseUrl
        }),
        new webpack.optimize.CommonsChunkPlugin({ name: ['aurelia'] })        
    ],
    // This is not necessary, it just changes the default port the
    // webpack-dev-server uses from 3000 to whatever you set here.
    devServer: {
        port: 53092
    },    
};
+4
source share

Source: https://habr.com/ru/post/1670408/


All Articles