Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Jul 13, 2020. It is now read-only.
This repository was archived by the owner on Jul 13, 2020. It is now read-only.

SyntaxError: Unexpected token import #542

Copy link
Copy link
@liketurbo

Description

@liketurbo
Issue body actions

SyntaxError: Unexpected token import, despite that I use babel.

import path from 'path';
import { System } from 'es-module-loader/core/loader-polyfill';

export default class HelloWorld {
  constructor(options) {
    this.options = options;
  }

  apply(compiler) {
    compiler.plugin('done', () => {
      this.done();
    });
  }

  done() {
    System.import(path.resolve('central.consts.js'))
      .then(m => console.log(m));
  }
}  

package.json script

"webpack:dev": "babel-node ./node_modules/.bin/webpack-cli --mode=development"

webpack.config.js

import path from 'path';

import HtmlWebpackPlugin from 'html-webpack-plugin';
import CentralConstsPlugin from './src/plugins/central-consts-plugin';

const basic = {
  entry: {
    app: './src/scripts/main.js',
  },
  output: {
    path: path.join(__dirname, 'build'),
    filename: '[name].js',
  },
};

const module = {
  rules: [
    {
      test: /\.js$/,
      use: ['babel-loader'],
    },
  ],
};

const plugins = [
  new CentralConstsPlugin(),
  new HtmlWebpackPlugin({
    template: path.join(__dirname, 'src/index.html'),
  }),
];

export default {
  ...basic,
  plugins,
  module,
};

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.